From 99c9c24b01a049f6c67c684fbbe33be43f2e308a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Proen=C3=A7a?= Date: Tue, 17 Jun 2014 16:51:58 +0100 Subject: [PATCH] Added simple support for SSL/TLS to SMTP. This simple change enables the SSL when using port 465 and TLS when using port 587. A more robust solutions would be to add UI configuration for the SMTPSecure option. --- src/includes/functions.inc.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/includes/functions.inc.php b/src/includes/functions.inc.php index cdca2c07..0721902f 100644 --- a/src/includes/functions.inc.php +++ b/src/includes/functions.inc.php @@ -386,6 +386,11 @@ function psm_build_mail($from_name = null, $from_email = null) { $phpmailer->IsSMTP(); $phpmailer->Host = psm_get_conf('email_smtp_host'); $phpmailer->Port = psm_get_conf('email_smtp_port'); + if ($phpmailer->Port == 587) { + $phpmailer->SMTPSecure = 'tls'; + } else if ($phpmailer->Port == 465) { + $phpmailer->SMTPSecure = 'ssl'; + } $smtp_user = psm_get_conf('email_smtp_username'); $smtp_pass = psm_get_conf('email_smtp_password');