Skip to content

Commit

Permalink
Add option MAIL_SMTP_USE_FROM_FOR_HELO to fix smtps best practice
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Dec 3, 2017
1 parent 9b5f709 commit b41213f
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions htdocs/core/class/smtps.class.php
Expand Up @@ -512,6 +512,8 @@ function _server_authenticate()
*/
function sendMsg($_bolTestMsg = false, $_bolDebug = false)
{
global $conf;

/**
* Default return value
*/
Expand All @@ -538,6 +540,15 @@ function sendMsg($_bolTestMsg = false, $_bolDebug = false)
$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');
}

Expand Down

0 comments on commit b41213f

Please sign in to comment.