Ecshop implements smtp mail and ecshopsmtp sends mail. Ecshop implements smtp mail sending. when ecshopsmtp sends mail using the ECShop smtp method, the statement in the get_data method is executed in the cls_smtp class file: copy the code such as ecshop to implement smtp mail sending and ecshopsmtp to send mail
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.
When sending an email using the smtp method of ECShop, the statement in the get_data method is executed in the cls_smtp class File: code such...