ecshop implements smtp to send emails, ecshopsmtp sends emails_PHP tutorial

WBOY
Release: 2016-07-13 10:08:00
Original
1045 people have browsed it

ecshop implements smtp to send emails, ecshopsmtp sends emails

When using ECShop's smtp method to send emails, in the cls_smtp class file, execute the statement in the get_data method:

Copy code The code is as follows:

$line = fgets($this->connection, 512);

;, a timeout error occurred.

Comment out the execution of this function and send the email directly, the error ehlo command failed will be returned.

But when the link data is printed out, it is indeed connected.

I could send emails normally using other programs before, so I resend the function and use phpmailer to send emails instead.

Copy code 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                                                                                                                                                                                                                                                                      $subject                                                                                                                                       $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 the entire content of this article, I hope you guys will like it.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/953148.htmlTechArticleecshop implements smtp to send emails, ecshopsmtp sends emails. When using ECShop's smtp method to send emails, in the cls_smtp class file, Execute the statement in the get_data method: Copy the code code such as...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!