错误406使用php邮件程序发送电子邮件时不允许

时间:2017-08-31 05:23:34

标签: php email smtp phpmailer email-integration

我正面临使用php邮件发送电子邮件的问题。我按照这篇文章 Click to see the steps

我只需下载此脚本并上传到我的服务器(Hostgator)。但它不起作用.. It shows 406 not allowed error while sending

以下是 tracker.php 文件

中的代码
    require ('phpmailer/PHPMailerAutoload.php');
    $from = "formget.dev@gmail.com";    //sender's username
    $pwd = "formgetmb";                 //sender's password
//-------------------------------------------------------SEND eMail----------------------------------------------------------------------
if (isset($_POST['mailto'])) {
    try {
        $mail = new PHPMailer(true); //New instance,exceptions enabled with true
        $to = $_POST['mailto'];
        $subject = $_POST['subject'];
        $id = rand(111, 999);
        $id.=rand(111, 999);
        $body = "This is the fixed message of test email to get notify when it is read.....";
        $body .= "<img border='0' src='http://www.zigsee.com/cvp/Booster/latestemailer/php-track-email/trackonline.php?email=$to&id=$id&subject=$subject' width='1' height='1' alt='image for email' >";
        $mail->IsSMTP();                           // tell the class to use SMTP
        $mail->SMTPAuth = true;                  // enable SMTP authentication
        $mail->Port = 25;                    // set the SMTP server port
        $mail->Host = "smtp.gmail.com"; // SMTP server
        $mail->Username = $from;     // SMTP server username
        $mail->Password = $pwd;            // SMTP server password
        $mail->From = $from;
        $mail->FromName = "TESTUSER";
        $mail->AddAddress($to);
        $mail->Subject = $subject;
        $mail->AltBody = "Please return read receipt to me."; // optional, comment out and test
        $mail->WordWrap = 80; // set word wrap
        $mail->MsgHTML($body);
        $mail->IsHTML(true); // send as HTML
        $mail->Send();

//return foll
        echo '<input id="id1" name="id" type="hidden" value="' . $id . '">'   
        . '<input id="email1" name="email" type="hidden" value="' . $to . '">'
        . '<label id="label1">Mail sent to <b>' . $to . '<b></label>';
    } catch (phpmailerException $e) {
        echo $e->errorMessage();
    }
}

0 个答案:

没有答案