我在网上搜索了这个问题,但没有一个能解决我的问题。我正尝试使用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