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
This commit is contained in:
celestora 2022-04-16 19:39:42 +03:00 committed by GitHub
parent b8fcf3d8e9
commit 46bb7bf0db
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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);
}