Test option MAIL_SMTP_USE_FROM_FOR_HELO to use domain of url

This commit is contained in:
Laurent Destailleur 2023-04-09 13:58:43 +02:00
parent b9e08dafab
commit f081768baa

View File

@ -476,13 +476,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.
// So if the from to is 'aaa <bbb@ccc.com>', we will keep 'ccc.com'
$hosth = $this->getFrom('addr');
$hosth = preg_replace('/^.*</', '', $hosth);
$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);
}
}