allow starttls and smtps for mailing

This commit is contained in:
bence committed 2024-10-19 22:44:51 +02:00
1 parent 66040d69db
commit ecec258a64
1 file changed
+4 -2
+4 -2
View File
@@ -44,8 +44,10 @@ class Mail
if (!empty($_ENV['MAIL_HOST'])) { if (!empty($_ENV['MAIL_HOST'])) {
$mailer->Mailer = 'smtp'; $mailer->Mailer = 'smtp';
$mailer->Host = $_ENV['MAIL_HOST']; $mailer->Host = $_ENV['MAIL_HOST'];
$mailer->Port = !empty($_ENV['MAIL_PORT']) ? $_ENV['MAIL_PORT'] : 25; $mailer->Port = !empty($_ENV['MAIL_PORT']) ? $_ENV['MAIL_PORT'] : 587;
$mailer->SMTPSecure = !empty($_ENV['MAIL_SECURE']) ? $_ENV['MAIL_SECURE'] : '';
$secureMaping = ['none' => '', 'starttls' => PHPMailer::ENCRYPTION_STARTTLS, 'smtps' => PHPMailer::ENCRYPTION_SMTPS];
$mailer->SMTPSecure = !empty($_ENV['MAIL_SECURE']) ? $secureMaping[$_ENV['MAIL_SECURE']] : '';
if (!empty($_ENV['MAIL_USER'])) { if (!empty($_ENV['MAIL_USER'])) {
$mailer->SMTPAuth = true; $mailer->SMTPAuth = true;