ECMall supports configuring SSL connections to the mail server _ PHP Tutorial

Source: Internet
Author: User
ECMall supports configuring SSL connections to the mail server. First, the phpmailer version used by ecmall is too low and does not support encrypted connections. Then, make some adjustments to the corresponding code. 1. to overwrite phpmailer, download it from the attachment: The first step of the copy generation is that the phpmailer version used by ecmall is too low and does not support encrypted connections.

Then, make some adjustments to the corresponding code.

1. overwrite phpmailer

Download the attachment:

The code is as follows:


Http://cywl.jb51.net: 81/201405/yuanma/ecmall_phpmailer_lib(jb51.netw..zip

2. modify lib

Two lib involved: mail. lib. php and mail_quequ.lib.php

Add a parameter to the constructor of these two classes. For example, Mailer

The code is as follows:


Function _ construct ($ from, $ email, $ protocol, $ host = '', $ port ='', $ user = '', $ pass = '', $ SMTPSecure = false) // add $ SMTPSecure
{
$ This-> Mailer ($ from, $ email, $ protocol, $ host, $ port, $ user, $ pass, $ SMTPSecure );
}

Function Mailer ($ from, $ email, $ protocol, $ host = '', $ port ='', $ user = '', $ pass = '', $ SMTPSecure = false)
....

The same is true for MailQueue.

3. encapsulate the call function

About 300 rows in global. lib. php

Add a row to function & get_mailer:

The code is as follows:


$ Secure = Conf: get ('email _ ssl '); // add this line
$ Mailer = new Mailer ($ sender, $ from, $ protocol, $ host, $ port, $ username, $ password, $ secure); // simultaneously pass parameters

4. adjust the background email settings page and add related settings

Background Template: setting.email_setting.html adds a configuration item

The code is as follows:



Email server encryption method:

{Html_radios name = "email_ssl" options = $ email_ssl checked = $ setting. email_ssl}
This function requires that your php must support the OpenSSL module. if you want to use this function, contact your space provider to confirm that this module is supported.


At the same time, modify the Mail test parameter transmission

The code is as follows:


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.