예제 #1
0
    if (DEBUG) {
        $OUTPUT .= tm_debugmessage("use template " . $Form_Filename);
    }
    $Form_Success_Filename = "Form_" . $frm_id . "_success.html";
    //formular
    if (DEBUG) {
        $OUTPUT .= tm_debugmessage("use template " . $Form_Success_Filename);
    }
    //set new tpl path
    $_Tpl_FRM->setTemplatePath($tm_formpath);
}
//get default smtp host, default, as fallback
if (DEBUG) {
    $MESSAGE .= tm_debugmessage("fetch default smtp host");
}
$HOST = $HOSTS->getStdSMTPHost();
$use_frm_smtphost = FALSE;
//get host form valid form
if ($use_form) {
    // && !$doptin_check
    //get host
    if (check_dbid($FRM[0]['host_id'])) {
        //valid host id found
        $HOST_FRM = $HOSTS->getHost($FRM[0]['host_id']);
        if ($HOST_FRM[0]['aktiv'] == 1 && $HOST_FRM[0]['type'] == 'smtp') {
            $use_frm_smtphost = TRUE;
            if (DEBUG) {
                $MESSAGE .= tm_debugmessage("found valid smtp host for this form");
            }
        } else {
            if (DEBUG) {
예제 #2
0
function validate_email($email, $from = "")
{
    $protocol = "";
    $HOSTS = new tm_HOST();
    $HOST = $HOSTS->getStdSMTPHost();
    if (empty($from)) {
        $from = $HOST[0]['sender_email'];
    }
    $Return = array(0 => true, 1 => "OK");
    list($userName, $mailDomain) = explode("@", $email, 2);
    //use explode instead of split, php5.3
    $protocol .= "from: " . $from . " \n";
    $protocol .= "to: " . $email . " \n";
    $mx = getmxrr($mailDomain, $mxhosts);
    $hc = count($mxhosts);
    if ($hc > 0) {
        //wir preuefen nur mal den ersten mx
        $host = $mxhosts[0];
        $protocol .= $host . " \n";
        //added @ to suppress possible error messages, thx to tms-schmidt
        //fixed bug id: 3114571
        //https://sourceforge.net/tracker/?func=detail&aid=3114571&group_id=190396&atid=933192
        $Connect = @fsockopen($host, 25, $errno, $errstr, 0.5);
        //timeout 0,5 sec
        usleep(100000);
        if ($Connect) {
            //aol hack
            /*
            //schwachsinnig! gibt schleife bis 220... ohoh
            do {
            					 $Out = fgets ( $Connect, 1024 );
            				} while (ereg("^220",$Out));
            */
            if (ereg("^220", $Out = fgets($Connect, 1024))) {
                //aol: if (ereg("^220", $Out)) {
                usleep(100000);
                fputs($Connect, "HELO " . $HOST[0]['smtp_domain'] . "\r\n");
                $Out = fgets($Connect, 1024);
                $protocol .= $Out . " \n";
                usleep(100000);
                fputs($Connect, "MAIL FROM: {$from}\r\n");
                $From = fgets($Connect, 1024);
                $protocol .= $From . " \n";
                usleep(100000);
                fputs($Connect, "RCPT TO: {$email}\r\n");
                $To = fgets($Connect, 1024);
                $protocol .= $To . " \n";
                usleep(100000);
                fputs($Connect, "QUIT\r\n");
                fclose($Connect);
                //http://www.faqs.org/rfcs/rfc821.html
                if (!ereg("^250", $From) || !ereg("^250", $To)) {
                    if (ereg("^4", $From) || ereg("^4", $To)) {
                        $Return[1] = ___("Server lehnt Mail ab, temporaerer Fehler, Greylisting etc.");
                        #."\n".$protocol."\n";
                    } else {
                        $Return[0] = false;
                        $Return[1] = ___("Server meldet Fehler, Adresse abgelehnt");
                        #."\n".$protocol."\n";
                    }
                }
            } else {
                $Return[0] = false;
                $Return[1] = ___("Keine Antwort vom Server.");
                #."\n".$protocol."\n";
            }
        } else {
            $Return[0] = false;
            $Return[1] = ___("Kann Verbindung zum Server nicht herstellen.") . " (" . $errno . " " . $errstr . ")";
            #."\n".$protocol."\n";
        }
    } else {
        //kein mx host gefunden $hc=0
        $Return[0] = false;
        $Return[1] = ___("Kein MX Eintrag (Validate)");
        #."\n".$protocol."\n";
    }
    $Return[1] .= "\n" . $protocol . "\n";
    return $Return;
}