Reputation: 21
I am using PHPMailer to send email using SMTP Google but receive following eror But what makes me confuse is this error occured intermitent, sometime the email successfully sent sometime i got this error
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
(
Below is the config for send email
$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 = '[email protected]'; // 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);
Really appeciate for Any suggestion or helps to fix this issue. Been almost 2 days but still no luck
Content of email is HTML format which declared in variable $msg.
$msg = $this->load->view('front/notif_reset_password',$data,true);
Below is the html of that view
<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:[email protected]" style="color:#a30046;font-weight:normal;text-decoration:underline" target="_blank">[email protected]</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>
Upvotes: 2
Views: 4001
Reputation: 38482
We get this error from PHPMailer when we hit our Gmail send limits.
You can check if it's the same thing happening to you by going into Gmail and trying to manually send an email. In our case that displays the more helpful error message about sending limits.
https://support.google.com/a/answer/166852?hl=en
Upvotes: 0
Reputation: 4945
Gmail disables SMTP by default and prefers access through their API. You have to enable support for "less secure" applications. See https://support.google.com/mail/answer/14257?rd=1
Upvotes: 1