使用PHP发送的SMTP总是失败响应错误

时间:2014-11-15 10:34:21

标签: php smtp

我在PHP中通过SMTP发送时遇到问题 我尝试了很多东西,更改smtp,更改代码,搜索新内容但总是相同的结果

代码

    require_once("class.phpmailer.php");
if ($_GET['check'] == "1") {
$smtpserver = "";
$smtpport = "";
$smtpuser = "";
$smtppass = "";
$from = "";
$to = "";
$msag = "test / $smtpserver - $smtpport - $smtpuser - $smtppass";
$datamasii= date("D M d, Y - g:i a");
try {
    $mail = new PHPMailer(true); //New instance, with exceptions enabled
    $mail->IsSMTP();                           // tell the class to use SMTP
    $mail->SMTPAuth   = true;                  // enable SMTP authentication
    $mail->Port       = $smtpport;                    // set the SMTP server port
    $mail->Host       = $smtpserver; // SMTP server
    $mail->Username   = $smtpuser;     // SMTP server username
    $mail->Password   = $smtppass;            // SMTP server password
    $mail->setFrom($from, 'test');
    $mail->AddAddress($to, "Member");
    $mail->Subject  = "test - $smtpserver $datamasii";
    $mail->MsgHTML($msag);
    $mail->IsHTML(true); // send as HTML
    $mail->Send();
    echo "OK";
} catch (phpmailerException $e) {
    echo "NO";
}


}

响应总是没有

0 个答案:

没有答案
相关问题