加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

ECMall支持SSL连接邮件服务器的配置方法详解

发布时间:2020-12-12 20:11:48 所属栏目:PHP教程 来源:网络整理
导读:首先,主要是ecmall使用的phpmailer版本太低,不支持加密连接。 然后,得对相应代码做一定调整。 1. 覆盖phpmailer 请从附件进行下载: 代码如下: http://cywl.jb51.cc:81/201405/yuanma/ecmall_phpmailer_lib(jb51.cc).zip 2. 改造lib 涉及到两个lib:mail.

首先,主要是ecmall使用的phpmailer版本太低,不支持加密连接。

然后,得对相应代码做一定调整。

1. 覆盖phpmailer

请从附件进行下载:

代码如下:
http://cywl.52php.cn:81/201405/yuanma/ecmall_phpmailer_lib(52php.cn).zip

2. 改造lib

涉及到两个lib:mail.lib.php 、mail_quequ.lib.php

在这两个类的构造函数中,增加一个参数传递。如Mailer

代码如下:
function __construct($from,$email,$protocol,$host = '',$port = '',$user = '',$pass = '',$SMTPSecure = false)//增加$SMTPSecure
{
$this->Mailer($from,$host,$port,$user,$pass,$SMTPSecure);
}

function Mailer($from,$SMTPSecure = false)
....

MailQueue中同理。

3. 封装调用函数

global.lib.php 约300行

function &get_mailer()中增加一行:

代码如下:
$secure = Conf::get('email_ssl');//增加这一行
$mailer = new Mailer($sender,$from,$username,$password,$secure);//同时传递参数

4. 调整后台email设置界面,增加相关设置项

后台模板:setting.email_setting.html 增加一个配置项

代码如下:

{html_radios name="email_ssl" options=$email_ssl checked=$setting.email_ssl}
    推荐文章
      热点阅读