From 46bb7bf0dbdf855413d8b57179b067826f622365 Mon Sep 17 00:00:00 2001 From: celestora Date: Sat, 16 Apr 2022 19:39:42 +0300 Subject: [PATCH] Include additional email configuration fields `email.user` can be set if the sending address is not your SMTP username all mail is being sent in plaintext SMTP unless `email.ssl` is set to true --- chandler/Email/Email.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/chandler/Email/Email.php b/chandler/Email/Email.php index 4b832eb..8f1cd59 100644 --- a/chandler/Email/Email.php +++ b/chandler/Email/Email.php @@ -28,16 +28,16 @@ class Email CHANDLER_ROOT_CONF["email"]["postmark"]["stream"] ); } else { - $transport = new Swift_SmtpTransport(CHANDLER_ROOT_CONF["email"]["host"], CHANDLER_ROOT_CONF["email"]["port"], "ssl"); - $transport->setUsername(CHANDLER_ROOT_CONF["email"]["addr"]); + $transport = new Swift_SmtpTransport(CHANDLER_ROOT_CONF["email"]["host"], CHANDLER_ROOT_CONF["email"]["port"], CHANDLER_ROOT_CONF["email"]["ssl"] ? "ssl" : NULL); + $transport->setUsername(CHANDLER_ROOT_CONF["email"]["user"] ?? CHANDLER_ROOT_CONF["email"]["addr"]); $transport->setPassword(CHANDLER_ROOT_CONF["email"]["pass"]); - + $message = new Swift_Message($subject); $message->getHeaders()->addTextHeader("Sensitivity", "Company-Confidential"); $message->setFrom(CHANDLER_ROOT_CONF["email"]["addr"]); $message->setTo($to); $message->setBody($html, "text/html"); - + $mailer = new Swift_Mailer($transport); return $mailer->send($message); }