This article mainly introduces the Ecshop to implement SMTP send mail, need friends can refer to the following
When you send a message using Ecshop SMTP, in the Cls_smtp class file, execute the statement in the Get_data method:
The code is as follows:
$line = fgets ($this->connection, 512);
, a timeout error occurred.
Comment out the execution of the function, send the message directly, then return the error EHLO command failed.
But when you print out the linked data, you do connect it.
Before using another program to send mail is also normal to send, and then resend the function, instead of phpmailer send mail.
The code is as follows:
function Smtp_mail ($name, $email, $subject, $content, $type = 1, $notification =false) {
/* If the message encoding is not ec_charset, create the character set conversion object, convert the encoding/
if ($GLOBALS [' _cfg '] [' mail_charset ']!= ec_charset)
{
$name = Ecs_iconv (Ec_charset, $GLOBALS [' _cfg '] [' mail_charset '], $name);
$subject = Ecs_iconv (Ec_charset, $GLOBALS [' _cfg '] [' mail_charset '], $subject);
$content = Ecs_iconv (Ec_charset, $GLOBALS [' _cfg '] [' mail_charset '], $content);
$shop _name = Ecs_iconv (Ec_charset, $GLOBALS [' _cfg '] [' mail_charset '], $GLOBALS [' _cfg '] [' shop_name ']);
}
$charset = $GLOBALS [' _cfg '] [' mail_charset '];
Include_once Root_path. ' includes/phpmailer/class.phpmailer.php ';
$mail = new Phpmailer ();
$mail->from = $GLOBALS [' _cfg '] [' smtp_user '];
$mail->fromname = "Yunnan * * * Broadcast Co., Ltd.";
if ($GLOBALS [' _cfg '] [' mail_service '] = = 0) {
$mail->ismail ();
} else {
$mail->issmtp ();
$mail->host = $GLOBALS [' _cfg '] [' smtp_host '];
$mail->port = $GLOBALS [' _cfg '] [' smtp_port '];
$mail->smtpauth =!empty ($GLOBALS [' _cfg '] [' smtp_pass ']);
$mail->username = $GLOBALS [' _cfg '] [' smtp_user '];
$mail->password = $GLOBALS [' _cfg '] [' smtp_pass '];
}
$mail->encoding = "base64";
$mail->priority = $this->priority;
$mail->charset = $charset;
$mail->ishtml ($type);
$mail->subject = $subject;
$mail->body = $content;
$mail->timeout = 30;
$mail->smtpdebug = false;
$mail->clearaddresses ();
$mail->addaddress ($email, $name);
$mail->confirmreadingto = $notification;
$res = $mail->send ();
if (! $res)
{
$GLOBALS [' Err ']->add ($mail->errorinfo);
$GLOBALS [' Err ']->add ($GLOBALS [' _lang '] [' sendemail_false ']);
return false;
}
return true;
}
The above is the entire content of this article, I hope that the small partners can enjoy.