![](/img/trans.png)
[英]Sending SMTP messages using PHPMailer, response of 'MAIL not accepted from server', why?
[英]PHPMailer - Mail not accepted from server Error
我在網上搜索了此問題,但沒有一個能解決我的問題。 我正在嘗試使用PHPMailer發送單個郵件。 但是我的瀏覽器屏幕上出現此錯誤。
SMTP -> FROM SERVER:
SMTP -> ERROR: RSET failed:
SMTP -> FROM SERVER:
SMTP -> ERROR: MAIL not accepted from server:
The following From address failed: mymailid@gmail.com : MAIL not accepted from server,,
SMTP server error:
Mailer Error: The following From address failed: mymailid@gmail.com : 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 = 'mymailid@gmail.com';
$mail -> Password = '*********';
$mail -> setFrom("mymailid@gmail.com","Name");
$mail -> addReplyTo("mymailid@gmail.com","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>";
}
?>
請幫我解決這個問題。 提前致謝。
Gmail不接受您的電子郵件和密碼正確無誤。 您應該使用真實的憑據進行身份驗證,否則它們將阻止它
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.