send email use ssl encryption if port is 465

This commit is contained in:
xiaomlove
2021-02-27 00:28:10 +08:00
parent 9633ab63ec
commit c0dbb23071

View File

@@ -1420,7 +1420,7 @@ function sent_mail($to,$fromname,$fromemail,$subject,$body,$type = "confirmation
$setting = get_setting('smtp');
// Create the Transport
$transport = (new Swift_SmtpTransport($setting['smtpaddress'], $setting['smtpport']))
$transport = (new Swift_SmtpTransport($setting['smtpaddress'], $setting['smtpport'], $setting['smtpport'] == 465 ? 'ssl' : null))
->setUsername($setting['accountname'])
->setPassword($setting['accountpassword'])
;