NEW Use by default the domain $dolibarr_main_url_root for SMTP HELO

This solves "Temporary unavailable" error with gmail smtp relay.
This commit is contained in:
Laurent Destailleur 2023-04-13 22:26:55 +02:00
parent 59cc3663a7
commit 8ab1b5923c
2 changed files with 10 additions and 2 deletions

View File

@ -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');

View File

@ -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 <bbb@ccc.com>', we will keep 'ccc.com'
// 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);
}
}