我正在使用PHPMailer使用SMTP Google发送电子邮件,但收到以下错误消息 但是让我感到困惑的是这个错误发生在间歇性的,有时候电子邮件成功发送有时我得到了这个错误
2016-03-11 08:00:50 SMTP ERROR: DATA END command failed: 2016-03-11 08:00:50 SMTP Error: data not accepted. 2016-03-11 08:00:50 CLIENT -> SERVER: QUIT 2016-03-11 08:01:50 SMTP ERROR: QUIT command failed:
phpmailerException Object
(
[message:protected] => SMTP Error: data not accepted.
[string:Exception:private] =>
[code:protected] => 2
[file:protected] => /home/anekapaperaindah/public_html/application/libraries/PHPMailer/class.phpmailer.php
[line:protected] => 1492
[trace:Exception:private] => Array
(
[0] => Array
(
[file] => /home/anekapaperaindah/public_html/application/libraries/PHPMailer/class.phpmailer.php
[line] => 1300
[function] => smtpSend
[class] => PHPMailer
[type] => ->
[args] => Array
(
以下是发送电子邮件的配置
$destino = $this->input->post('email');
$mail = new PHPMailer(true);
$mail->Mailer = 'smtp';
$mail->SMTPDebug = 1;
// $mail->SMTPDebug = true;
$mail->IsSMTP(); // we are going to use SMTP
$mail->SMTPAuth = true; // enabled SMTP authentication
$mail->SMTPSecure = "ssl"; // prefix for secure protocol to connect to the server
$mail->Host = "smtp.gmail.com"; // setting GMail as our SMTP server
$mail->Port = 465; // SMTP port to connect to GMail
$mail->Username = 'admin@anekapaperaindah.id'; // user email address
$mail->Password = '********'; // password in GMail
$mail->SetFrom($get_email, $company_name); //Who is sending the email
$mail->AddReplyTo($get_email, $company_name); //email address that receives the response
$mail->Subject = "Reset Password";
$mail->SMTPKeepAlive = true;
$mail->Priority = 1;
$mail->Debugoutput = 'echo';
$mail->Timeout = 60;
//$mail->SMTPDebug=3;
//$mail->Body = 'tet';;
$mail->isHTML(true);
$mail->MsgHTML($msg);
$mail->AddAddress($destino);
真的适用任何建议或帮助解决此问题。 差不多2天但仍然没有运气
电子邮件内容是HTML格式,在变量$ msg中声明。
$msg = $this->load->view('front/notif_reset_password',$data,true);
以下是该视图的html
<table border="0" cellpadding="0" cellspacing="0" width="560" style="background:#ffffff;border:1px solid #cccccc;margin-top:10px" bgcolor="#FFFFFF">
<tbody><tr>
<td align="center" valign="top" style="border-collapse:collapse">
<table border="0" cellpadding="23" cellspacing="0" width="100%" style="background:#ffffff;border-bottom-width:0" bgcolor="#FFFFFF">
<tbody><tr>
<td style="border-collapse:collapse;border-bottom: 3px solid #081071;text-align:center;vertical-align:top" align="left" valign="top">
<img src="http://i650.photobucket.com/albums/uu229/bayu288/logo-aneka_1.png" border="0" alt=" photo logo-aneka.png"/>
<!--<a href="" style="color:#a30046;font-weight:normal;text-decoration:none" target="_blank">
<img alt="Aneka" height="80" src="http://i650.photobucket.com/albums/uu229/images/logo-aneka.png" style="border:0;min-height:auto;line-height:100%;max-width:302px;outline:none;text-decoration:none" width="302" >
</a>-->
</td>
</tr>
</tbody></table>
</td>
</tr>
<tr>
<td align="center" valign="top" style="border-collapse:collapse">
<table border="0" cellpadding="0" cellspacing="0" width="560">
<tbody><tr>
<td valign="top" style="background:#ffffff;border-collapse:collapse" bgcolor="#FFFFFF">
<table border="0" cellpadding="23" cellspacing="0" width="100%">
<tbody><tr>
<td valign="top" style="border-collapse:collapse">
<div style="color:#808080;font-family:Arial;font-size:14px;line-height:150%;text-align:left" align="left">
<div style="color:#808080;font-family:Arial;font-size:14px;line-height:150%;margin:5px 2px;text-align:left" align="left"></div>
<p>Selamat Datang Di PT. Aneka Papera Indah,</p>
<div style="color:#808080;font-family:Arial;font-size:14px;line-height:150%;margin:5px 2px;text-align:left" align="left">
<p><b>Your Detail Information</b></p>
<table style="color:#808080;font-family:Arial;font-size:12px;line-height:150%;text-align:left">
<tr>
<td>Email</td>
<td>:</td>
<td><?php echo $email ?></td>
</tr>
<tr>
<td>Kode Verifikasi</td>
<td>:</td>
<td><?php echo $token_id ?></td>
</tr>
</table>
<table border="0" cellpadding="5" cellspacing="0" width="100%" style="background:#ffffff;border-collapse:collapse;border:1px solid #cccccc;font-size:12px;margin-bottom:25px" bgcolor="#FFFFFF">
</table>
<table width="100%" style="background:#def0e5;color:#808080;font-family:Arial;font-size:12px;line-height:150%;margin-bottom:40px;text-align:left" bgcolor="#DEF0E5">
<tbody>
<tr>
<td style="border-collapse:collapse;text-align:right;vertical-align:middle" align="right" valign="middle">
<span style="background:#DEF0E5;display:block;min-height:26px;"></span>
</td>
<td style="border-collapse:collapse;vertical-align:middle;text-align: center;" valign="middle">
<p>
<a href="<?php echo base_url().'isms_front_aneka_ctrl/reset_password.html?email='.$email.'&key='.$token_id ?>">Reset Password Anda</a>
</p>
</td>
</tr>
</tbody>
</table>
</div>
<div style="color:#808080;font-family:Arial;font-size:14px;line-height:150%;margin:5px 2px;text-align:left" align="left">
<div style="color:#808080;font-family:Arial;font-size:14px;line-height:150%;text-align:left" align="left">
<br>
Terima kasih atas perhatian dan kepercayaan Anda.
<br>
<br>
<a href="" style="color:#081071;font-weight:normal;text-decoration:none" target="_blank">
<strong>PT Aneka Papera Indah</strong>
</a>
<div style="color:#808080;font-family:Arial;font-size:14px;line-height:150%;text-align:left" align="left">
<div style="color:inherit;font-family:Arial;font-size:14px;line-height:150%;text-align:left;text-decoration:none" align="left">
<?php echo $address ?>
<br>
<?php echo $city ?>
</div>
<span><?php echo $phone ?></span>
-
<span><?php echo $fax ?></span>
</div>
<span>
E-mail :
<a href="mailto:cs@aneka.com" style="color:#a30046;font-weight:normal;text-decoration:underline" target="_blank">cs@anekapaperindah.com</a>
</span>
</div>
<br>
</div>
</div>
</td>
</tr>
</tbody></table>
</td>
</tr>
</tbody></table>
</td>
</tr>
<tr>
<td align="center" valign="top" style="border-collapse:collapse">
<table border="0" cellpadding="0" cellspacing="0" width="560" style="background:#ffffff;border-top-width:0" bgcolor="#FFFFFF">
<tbody><tr>
<td valign="top" style="border-collapse:collapse">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody><tr>
<td width="23px" style="border-collapse:collapse"></td>
<td valign="middle" style="background:#ffffff;border-collapse:collapse;border:0" bgcolor="#FFFFFF">
<div style="border-top-color:#e8e8e8;border-top-style:solid;border-top-width:1px;color:#707070;font-family:Arial;font-size:10px;line-height:150%;text-align:left" align="left">
<br>
Follow us
<a href="<?php echo $twitter ?>" style="color:#a30046;font-weight:bold;text-decoration:none" target="_blank">@aneka</a>
<font color="#CCCCCC"></font>
| Like us on
<a href="<?php echo $facebook ?>" style="color:#a30046;font-weight:bold;text-decoration:none" target="_blank">Facebook.</a>
</div>
<br>
</td>
<td width="23px" style="border-collapse:collapse"></td>
</tr>
</tbody></table>
</td>
</tr>
</tbody></table>
</td>
</tr>
<tr><td><table border="0" cellpadding="10" cellspacing="0" width="560" style="border-collapse:collapse">
<tbody><tr>
<td valign="top" style="border-collapse:collapse">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody><tr>
<td align="center" valign="middle" style="border-collapse:collapse;color:#999;display:block;font-family:Arial;font-size:10px;font-weight:normal;line-height:130%">
<div>
</div>
</td>
</tr>
</tbody></table>
</td>
</tr>
</tbody></table>
</td></tr></tbody></table>
答案 0 :(得分:1)
Gmail默认情况下禁用SMTP,并且更喜欢通过其API访问。你必须支持&#34;不太安全&#34;应用。见https://support.google.com/mail/answer/14257?rd=1
答案 1 :(得分:0)
当我们点击 Gmail发送限制时,我们从PHPMailer收到此错误。
您可以通过访问Gmail并尝试手动发送电子邮件来检查是否发生了同样的事情。在我们的情况下,显示有关发送限制的更有用的错误消息。