if ($required == "Y" && empty($UNTRUSTED[$fieldname])) {
         $errors .= "<li>" . $headertext . " " . $lang['isrequired'];
     }
     break;
 case "email":
     if (!empty($UNTRUSTED[$fieldname])) {
         $useremail = filter_html($UNTRUSTED[$fieldname]);
     }
     // if required:
     if ($required == "Y" && empty($UNTRUSTED[$fieldname])) {
         $errors .= "<li>" . $headertext . " " . $lang['isrequired'];
     }
     if ($required == "Y" && !good_emailaddress($useremail)) {
         $errors .= "<li>" . $lang['txt185'];
     }
     if ($required != "Y" && !empty($UNTRUSTED[$fieldname]) && !good_emailaddress($useremail)) {
         $errors .= "<li>" . $lang['txt185'];
     }
     break;
 case "checkboxes":
     $values = "";
     $comma = "";
     for ($k = 0; $k < 99; $k++) {
         $checkfieldname = $fieldname . "__" . $k;
         if (!empty($UNTRUSTED[$checkfieldname])) {
             $values .= $comma . urlencode(filter_html($UNTRUSTED[$checkfieldname]));
             $comma = ",";
         }
     }
     // if required:
     if ($required == "Y" && empty($values)) {
/**
 * Sends a e-mail message
 * 
 * @param string  myname - name of the person sending the e-mail
 * @param string  myemail - e-mail of the person sending the e-mail
 * @param string  contactname - name of the person being contacted.
 * @param string  contactemail - e-mail of the person being contacted
 * @param string  subject - subject of teh message.
 * @param string  message - the message.. 
 * @param string  contenttype - content type (text/html / text/plain)
 * @param string  charset - charset (iso-8859-1)
 * @param bool $useCRLF use Carriage Return/Linefeed (CRLF) line breaks or not.. if true uses \r\n else uses \n
 *
 * @return bool true if sent e-mail false otherwise..
 */
function send_message($myname, $myemail, $contactname, $contactemail, $subject, $message, $contenttype, $charset, $useCRLF = false)
{
    global $CSLH_Config;
    if ($useCRLF) {
        $newline = "\r\n";
    } else {
        $newline = "\n";
    }
    $headers = "MIME-Version: 1.0" . $newline;
    $headers .= "Content-type: {$contenttype}; charset={$charset}" . $newline;
    $headers .= "X-Mailer: php" . $newline;
    if (!good_emailaddress($contactemail)) {
        // to avoid relay errors make this do_not_reply@currentdomain.com
        if (!empty($_SERVER['HTTP_HOST'])) {
            $host = str_replace("www.", "", $_SERVER['HTTP_HOST']);
            $contactemail = "do_not_reply@" . $host;
        } else {
            $contactemail = "*****@*****.**";
        }
    }
    if (!good_emailaddress($myemail)) {
        // to avoid relay errors make this do_not_reply@currentdomain.com
        if (!empty($_SERVER['HTTP_HOST'])) {
            $host = str_replace("www.", "", $_SERVER['HTTP_HOST']);
            $myemail = "do_not_reply@" . $host;
        } else {
            $myemail = "*****@*****.**";
        }
    }
    $headers .= "From: " . $myemail . $newline;
    if ($CSLH_Config['smtp_host'] != "") {
        $rtn = smtpmail($contactemail, $subject, $message, $headers);
    } else {
        $rtn = mail($contactemail, $subject, $message, $headers);
    }
    return $rtn;
}