Ecshop implementing SMTP Sending mail
This article mainly describes the Ecshop implementation of SMTP send mail, the need for friends can refer to the following
When you send a message by 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 time-out error occurred.
Commenting out the execution of the function and sending the message directly, the error EHLO command failed is returned.
But when I print out the linked data, it's really connected.
Before sending a message with another program can be sent normally, and then resend the function, instead of using Phpmailer to send mail.
The code is as follows:
function Smtp_mail ($name, $email, $subject, $content, $type = 1, $notification =false) {
/* If message encoding is not ec_charset, create character set conversion object, convert code */
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 whole content of this article, I hope that small partners can enjoy.
http://www.bkjia.com/PHPjc/952850.html www.bkjia.com true http://www.bkjia.com/PHPjc/952850.html techarticle ecshop Implementing SMTP Send mail This article mainly describes the Ecshop implementation SMTP send mail, the need for friends can refer to the following using Ecshop SMTP way to send mail, in the Cls_smtp class file ...