diff --git a/htdocs/core/class/smtps.class.php b/htdocs/core/class/smtps.class.php index e318f901fbb..e54a732f662 100644 --- a/htdocs/core/class/smtps.class.php +++ b/htdocs/core/class/smtps.class.php @@ -512,6 +512,8 @@ class SMTPs */ function sendMsg($_bolTestMsg = false, $_bolDebug = false) { + global $conf; + /** * Default return value */ @@ -538,6 +540,15 @@ class SMTPs $host=preg_replace('@ssl://@i','',$host); // Remove prefix $host=preg_replace('@tls://@i','',$host); // Remove prefix + if (! empty($conf->global->MAIL_SMTP_USE_FROM_FOR_HELO)) + { + // If the from to is 'aaa ', we will keep 'ccc.com' + $host = $this->getFrom('addr'); + $host = preg_replace('/^.*.*$/', '', $host); + $host = preg_replace('/.*@/', '', $host); + } + $_retVal = $this->socket_send_str('HELO ' . $host, '250'); }