PHPMailer-使用SMTP Gmail不接受错误数据

PHPMailer-使用SMTP Gmail不接受错误数据,php,email,phpmailer,Php,Email,Phpmailer,我使用PHPMailer发送电子邮件使用SMTP谷歌,但收到以下eror 但让我困惑的是,这个错误是间歇性的,有时电子邮件成功发送,有时我收到了这个错误 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:0

我使用PHPMailer发送电子邮件使用SMTP谷歌,但收到以下eror 但让我困惑的是,这个错误是间歇性的,有时电子邮件成功发送,有时我收到了这个错误

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);
非常乐意接受任何建议或帮助解决此问题。 已经快两天了,但还是没有运气

电子邮件的内容是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">
&nbsp;
<br>
Follow us
<a href="<?php echo $twitter ?>" style="color:#a30046;font-weight:bold;text-decoration:none" target="_blank">@aneka</a>
&nbsp;
<font color="#CCCCCC"></font>
| &nbsp;Like us on&nbsp;
<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>

西拉马特-大唐第二PT。安妮卡·帕帕·因达

您的详细信息

电子邮件 : 科德卡西酒店 :


泰里玛·卡西(Terima kasih)是一位伟大的领袖,也是一位伟大的领袖。


- 电邮:

跟我们来 |喜欢我们吗

默认情况下,Gmail禁用SMTP,并首选通过其API进行访问。您必须支持“不太安全”的应用程序。请参见当我们达到Gmail发送限制时,我们从PHPMailer获得此错误

你可以通过进入Gmail并尝试手动发送电子邮件来检查是否发生了同样的事情。在我们的例子中,它显示了关于发送限制的更有用的错误消息


看起来服务器端的某些过滤器决定不应接受该电子邮件的内容。所以问题是:内容是什么?你能把它寄出去吗?谢谢可能值得尝试将
SetFrom
设置为您正在登录的电子邮件,而不是用户输入。@arkascha done…@Matt SetFrom值与Username几乎相同。我已经试过用SetFrom的set值,但没有luckI也经历过这样的行为。我的代码工作了几年都没有问题,但是今天在负载过重的情况下,我偶尔也会遇到这个错误,我也曾经遇到过,而且还是没有运气,但更让我困惑的是,这个错误是间歇性的,有时电子邮件成功发送,有时我收到了这个错误。Gmail往往有非常激烈的反垃圾邮件措施。你可能被暂时列入黑名单。获取SMTP服务器发送的实际错误消息会很有帮助。谷歌通常会在每个错误代码中发送一条有用的消息。如果“数据不被接受”是实际的消息,那么您的编码可能有问题,具体取决于您的邮件内容。