Ecshop Implement SMTP Send mail

Source: Internet
Author: User
Tags character set

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.

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.