First of all, the main reason is that the phpmailer version used by ecmall is too low and does not support encrypted connections.
Then, you have to make certain adjustments to the corresponding code.
1. Cover phpmailer
Please download from the attachment:
2. Modify lib
Involves two libs: mail.lib.php, mail_quequ.lib.php
In the constructors of these two classes, add a parameter to pass. Such as Mailer
function Mailer($from, $email, $protocol, $host = '', $port = '', $user = '', $pass = '', $SMTPSecure = false)
... .
The same applies to MailQueue.
3. Encapsulate calling functions
global.lib.php is about 300 lines
Add a line in function &get_mailer():
4. Adjust the background email setting interface and add related setting items
Backend template: setting.email_setting.html Add a configuration item
$this->show_message('edit_email_setting_successed');
}
}
以及测试邮件方法。
/* 使用mailer类 */
import('mailer.lib');
$mailer = new Mailer($email_from, $email_addr, $email_type, $email_host, $email_port, $email_id, $email_pass, $email_ssl);//增加
$mail_result = $mailer->send($email_test, $email_subject, $email_content, CHARSET, 1);
if ($mail_result)
{
$this->json_result('', 'mail_send_succeed');
}
else
{
$this->json_error('mail_send_failure', implode("n", $mailer->errors));
}
}
else
{
$this->show_warning('Hacking Attempt');
}
}
tls方式没有测试过。