2
0
forked from Wavyzz/dolibarr

Add option MAIL_SMTP_USE_FROM_FOR_HELO to fix smtps best practice

This commit is contained in:
Laurent Destailleur
2017-12-03 20:08:53 +01:00
parent 9b5f7099f7
commit b41213f9a1

View File

@@ -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 <bbb@ccc.com>', we will keep 'ccc.com'
$host = $this->getFrom('addr');
$host = preg_replace('/^.*</', '', $host);
$host = preg_replace('/>.*$/', '', $host);
$host = preg_replace('/.*@/', '', $host);
}
$_retVal = $this->socket_send_str('HELO ' . $host, '250');
}