ecshop實現smtp發送郵件_PHP教程

來源:互聯網
上載者:User

ecshop實現smtp發送郵件


  這篇文章主要介紹了ecshop實現smtp發送郵件,需要的朋友可以參考下

  使用ECShop的smtp方式發送郵件時,在cls_smtp類檔案中,執行到get_data方法中的語句:

  代碼如下:

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

  ;時,發生逾時錯誤。

  注釋掉該函數的執行,直接發送郵件,則返回錯誤ehlo command failed。

  但列印出連結資料時,確實連上了。

  之前用別的程式發送郵件也是可以正常發送的,於是重新發送函數,改用phpmailer發送郵件。

  代碼如下:

  function smtp_mail($name, $email, $subject, $content, $type = 1, $notification=false) {

  /* 如果郵件編碼不是EC_CHARSET,建立字元集轉換對象,轉換編碼 */

  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 = '雲南***播有限公司';

  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;

  }

  以上就是本文的全部內容了,希望小夥伴們能夠喜歡。

http://www.bkjia.com/PHPjc/952850.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/952850.htmlTechArticleecshop實現smtp發送郵件 這篇文章主要介紹了ecshop實現smtp發送郵件,需要的朋友可以參考下 使用ECShop的smtp方式發送郵件時,在cls_smtp類檔案中...

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.