diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index b3991ecfcf2..d70de618be8 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -967,6 +967,10 @@ class Conf $this->global->MAIN_MAIL_ADD_INLINE_IMAGES_IF_DATA = 1; } + if (!isset($this->global->MAIL_SMTP_USE_FROM_FOR_HELO)) { + $this->global->MAIL_SMTP_USE_FROM_FOR_HELO = 2; + } + if (!defined('MAIN_ANTIVIRUS_BYPASS_COMMAND_AND_PARAM')) { if (defined('MAIN_ANTIVIRUS_COMMAND')) { $this->global->MAIN_ANTIVIRUS_COMMAND = constant('MAIN_ANTIVIRUS_COMMAND'); diff --git a/htdocs/core/class/smtps.class.php b/htdocs/core/class/smtps.class.php index e7b0207595a..fe1f90dd735 100644 --- a/htdocs/core/class/smtps.class.php +++ b/htdocs/core/class/smtps.class.php @@ -665,13 +665,17 @@ class SMTPs if (!is_numeric($conf->global->MAIL_SMTP_USE_FROM_FOR_HELO)) { // If value of MAIL_SMTP_USE_FROM_FOR_HELO is a string, we use it as domain name $hosth = $conf->global->MAIL_SMTP_USE_FROM_FOR_HELO; - } else { + } elseif ($conf->global->MAIL_SMTP_USE_FROM_FOR_HELO == 1) { // If value of MAIL_SMTP_USE_FROM_FOR_HELO is 1, we use the domain in the from. - // If the from to is 'aaa ', we will keep 'ccc.com' + // So if the from to is 'aaa ', we will keep 'ccc.com' $hosth = $this->getFrom('addr'); $hosth = preg_replace('/^.*.*$/', '', $hosth); $hosth = preg_replace('/.*@/', '', $hosth); + } elseif ($conf->global->MAIL_SMTP_USE_FROM_FOR_HELO == 2) { + // If value of MAIL_SMTP_USE_FROM_FOR_HELO is 2, we use the domain in the $dolibarr_main_url_root. + global $dolibarr_main_url_root; + $hosth = getDomainFromURL($dolibarr_main_url_root, 1); } }