ecshop绕过禁用SMTP发送邮件

2016-09-07 22:02 来源:www.chinab4c.com 作者:ecshop专家

现在很多服务器商都会由于禁用SMTP,防止用户滥发邮件,让系统更稳定。 这里如果禁用,采用如下修改方法即可解决问题,

 在ecshop种修改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'
)//www.zuimoban.com
),
'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;
}

(责任编辑:chinab4c)