我在網上搜索了這個問題,但沒有一個能解決我的問題。我正嘗試使用PHPMailer發送單個郵件。但是我在瀏覽器屏幕上出現了這個錯誤。PHPMailer - 從服務器接收不到郵件錯誤
SMTP -> FROM SERVER:
SMTP -> ERROR: RSET failed:
SMTP -> FROM SERVER:
SMTP -> ERROR: MAIL not accepted from server:
The following From address failed: [email protected] : MAIL not accepted from server,,
SMTP server error:
Mailer Error: The following From address failed: [email protected] : MAIL not accepted from server
我的發送郵件的代碼是。
<?php
require_once('mailer/class.phpmailer.php');
date_default_timezone_set('Asia/Kolkata');
$to = $_POST['to'];
$subject = $_POST['subject'];
$msg = $_POST['msg'];
$mail = new PHPMailer();
$mail -> SMTPDebug = 2;
$mail -> IsSMTP();
$mail -> SMTPSecure = 'tls';
$mail -> Host = 'smtp.gmail.com';
$mail -> Port = 587;
$mail -> SMTPAuth = true;
$mail -> Username = '[email protected]';
$mail -> Password = '*********';
$mail -> setFrom("[email protected]","Name");
$mail -> addReplyTo("[email protected]","Name");
$mail -> Subject = $subject;
$mail -> msgHTML($msg);
$mail -> addAddress($to);
if(!$mail -> send()) {
echo "<h3>Mailer Error: ". $mail-> ErrorInfo . "</h3>";
}
else {
echo "<h1>Email Sent Successfully.</h1>";
}
?>
請幫我解決這個問題。提前致謝。
Manoj庫馬爾,取代這些,然後嘗試, 1]替換'$ mail - > SMTPSecure ='tls';'用'$ mail - > SMTPSecure ='ssl '; 2]替換'$ mail - > Port = 587; '用$ mail - > Port = 465; '(都是好的,但如果出現錯誤,請使用這個) – SHAZ 2014-11-21 06:29:06
不,不要這樣做。你不應該使用ssl - 它自1998年起就被棄用了,並且不會對你的問題產生影響,並且在安全連接建立之後即將出現這個錯誤。如果您發佈了完整的SMTP轉錄本,這將有所幫助 - 向我們展示導致錯誤的原因,而不僅僅是後來發生的事情。 – Synchro 2014-11-21 07:20:29
感謝您的回覆。我也在我的Gmail帳戶中啓用「允許安全性較低的應用程序訪問」選項。仍然錯誤是一樣的。 – Mdumanoj 2014-11-21 12:21:21