码迷,mamicode.com
首页 > Windows程序 > 详细

ECSHOP使用第三方WEBAPI来发送邮件

时间:2015-05-05 23:21:36      阅读:168      评论:0      收藏:0      [点我收藏+]

标签:

   由于服务器商禁用了SMTP,所有到网上找了一个邮件代理商.http://www.mandrill.com/

  修改lib_base.php

 将此函数原有的内容注释掉,用下面的方法进行替换.即可绕过服务器使用80发送邮件.

function send_mail($name, $email, $subject, $content, $type = 0, $notification=false){

include_once(ROOT_PATH . ‘includes/mandrill/Mandrill.php‘);

try {
 
$mandrill = new Mandrill($GLOBALS[‘_CFG‘][‘smtp_pass‘]);
$message = array(
‘text‘ => ‘‘,
‘html‘ => $content,
‘subject‘ =>$subject,
‘from_email‘ => $GLOBALS[‘_CFG‘][‘smtp_mail‘],
‘from_name‘ =>$shop_name,
‘to‘ => array(
array(
‘email‘ => $email,
‘name‘ => $name,
‘type‘ => ‘to‘
)
),
‘headers‘ => array(‘Reply-To‘ => ‘calvin@katady.com‘)

);
//$async = false;
//$ip_pool = ‘Main Pool‘;
//$send_at = ‘2015-05-05 16:56:01‘;
$result = $mandrill->messages->send($message);
return true;
//print_r($result);
} catch(Mandrill_Error $e) {
// Mandrill errors are thrown as exceptions
echo ‘A mandrill error occurred: ‘ . get_class($e) . ‘ - ‘ . $e->getMessage();
// A mandrill error occurred: Mandrill_Unknown_Subaccount - No subaccount exists with the id ‘customer-123‘
throw $e;
}

ECSHOP使用第三方WEBAPI来发送邮件

标签:

原文地址:http://www.cnblogs.com/trandexp/p/4480600.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!