From 26618f525b111a4c081fb5068ad7020704415fd8 Mon Sep 17 00:00:00 2001 From: sxntxn <44604448+sxntxn@users.noreply.github.com> Date: Wed, 8 Jul 2020 05:39:23 +0200 Subject: [PATCH] Add option to configure SMTP HELO hostname --- app/Core/Mail/Transport/Smtp.php | 3 +++ app/constants.php | 1 + config.default.php | 1 + 3 files changed, 5 insertions(+) diff --git a/app/Core/Mail/Transport/Smtp.php b/app/Core/Mail/Transport/Smtp.php index 7338a81ef..d17c52a0e 100644 --- a/app/Core/Mail/Transport/Smtp.php +++ b/app/Core/Mail/Transport/Smtp.php @@ -23,6 +23,9 @@ class Smtp extends Mail $transport = Swift_SmtpTransport::newInstance(MAIL_SMTP_HOSTNAME, MAIL_SMTP_PORT); $transport->setUsername(MAIL_SMTP_USERNAME); $transport->setPassword(MAIL_SMTP_PASSWORD); + if (!is_null(MAIL_SMTP_HELO_NAME)) { + $transport->setLocalDomain(MAIL_SMTP_HELO_NAME); + } $transport->setEncryption(MAIL_SMTP_ENCRYPTION); if (HTTP_VERIFY_SSL_CERTIFICATE === false) { diff --git a/app/constants.php b/app/constants.php index 62f517fb9..8ffb4c40a 100644 --- a/app/constants.php +++ b/app/constants.php @@ -109,6 +109,7 @@ defined('MAIL_SMTP_HOSTNAME') or define('MAIL_SMTP_HOSTNAME', getenv('MAIL_SMTP_ defined('MAIL_SMTP_PORT') or define('MAIL_SMTP_PORT', intval(getenv('MAIL_SMTP_PORT')) ?: 25); defined('MAIL_SMTP_USERNAME') or define('MAIL_SMTP_USERNAME', getenv('MAIL_SMTP_USERNAME') ?: ''); defined('MAIL_SMTP_PASSWORD') or define('MAIL_SMTP_PASSWORD', getenv('MAIL_SMTP_PASSWORD') ?: ''); +defined('MAIL_SMTP_HELO_NAME') or define('MAIL_SMTP_HELO_NAME', getenv('MAIL_SMTP_HELO_NAME') ?: null); defined('MAIL_SMTP_ENCRYPTION') or define('MAIL_SMTP_ENCRYPTION', getenv('MAIL_SMTP_ENCRYPTION') ?: null); defined('MAIL_SENDMAIL_COMMAND') or define('MAIL_SENDMAIL_COMMAND', getenv('MAIL_SENDMAIL_COMMAND') ?: '/usr/sbin/sendmail -bs'); diff --git a/config.default.php b/config.default.php index 66b2daa1f..2f70a6126 100644 --- a/config.default.php +++ b/config.default.php @@ -52,6 +52,7 @@ define('MAIL_SMTP_HOSTNAME', ''); define('MAIL_SMTP_PORT', 25); define('MAIL_SMTP_USERNAME', ''); define('MAIL_SMTP_PASSWORD', ''); +define('MAIL_SMTP_HELO_NAME', null); // valid: null (default), or FQDN define('MAIL_SMTP_ENCRYPTION', null); // Valid values are null (not a string "null"), "ssl" or "tls" // Sendmail command to use when the transport is "sendmail"