From 30c6772666979176bf4e5a0972c57f8f40a536c8 Mon Sep 17 00:00:00 2001 From: Jason Munro Date: Fri, 12 Oct 2018 12:04:24 -0500 Subject: [PATCH] fix outbound reply-to when no profile is enabled issue #291 --- modules/smtp/modules.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/modules/smtp/modules.php b/modules/smtp/modules.php index ea1a417d99..d39998db65 100644 --- a/modules/smtp/modules.php +++ b/modules/smtp/modules.php @@ -1212,14 +1212,19 @@ function smtp_refresh_oauth2_token_on_send($smtp_details, $mod, $smtp_id) { if (!hm_exists('outbound_address_check')) { function outbound_address_check($mod, $from, $reply_to) { $domain = $mod->config->get('default_email_domain'); + if (!$domain) { + if (array_key_exists('HTTP_HOST', $mod->request->server)) { + $domain = $mod->request->server['HTTP_HOST']; + } + } if ($domain) { if (!is_email_address($from)) { $from = $from.'@'.$domain; } - if (!is_email_address($reply_to)) { - if (!trim($reply_to)) { - $reply_to = $smtp_details['user']; - } + if (!trim($reply_to)) { + $reply_to = $from; + } + elseif (!is_email_address($reply_to)) { $reply_to = $reply_to.'@'.$domain; } }