Ecshop implements smtp mail sending. Ecshop implements smtp mail sending this article mainly introduces how ecshop implements smtp mail sending. if you need it, you can refer to the ECShop smtp method to send mail, in the cls_smtp file, ecshop implements smtp mail sending.
This article mainly introduces how to use ecshop to send emails through smtp. For more information, see
When sending an email using ECShop smtp, execute the following statement in the get_data method in the cls_smtp class file:
The code is as follows:
$ Line = fgets ($ this-> connection, 512 );
;, Timeout error occurs.
Comment out the execution of this function and send an email directly. the error ehlo command failed is returned.
However, when the link data is printed, it is connected.
Previously, emails can be sent normally by using other programs. Therefore, the resend function uses phpmailer to send emails.
The code is as follows:
Function smtp_mail ($ name, $ email, $ subject, $ content, $ type = 1, $ notification = false ){
/* If the email encoding is not EC_CHARSET, create a character set conversion object and 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 *** Broadcasting 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 all the content of this article. I hope my friends will like it.
This article mainly introduces how to use ecshop to send mails through smtp. if you need it, refer to the cls_smtp file when sending mails using the smtp method of ECShop...