首页 > 网站 > 建站经验 > 正文

ecshop绕过禁用SMTP发送邮件

2024-04-25 20:38:38
字体:
来源:转载
供稿:网友

现在很多服务器商都会由于禁用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@moke8.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;

}

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表