From 0c0e60242d263f305a9b2c8e3362ea9acac39d48 Mon Sep 17 00:00:00 2001 From: tassium Date: Wed, 15 Jan 2003 14:38:35 +0000 Subject: [PATCH] Modified Deliver_SMTP to use HTTP_HOST in SMTP HELO commands. If HTTP_HOST is not set, fall back to original SquirrelMail behavior. (Use $domain) Should close #560524 (SMTP DNS resolution) git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@4422 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- ChangeLog | 2 ++ class/deliver/Deliver_SMTP.class.php | 16 ++++++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0094614c..06b7f240 100644 --- a/ChangeLog +++ b/ChangeLog @@ -26,6 +26,8 @@ Version 1.4.0 RC 2 - Move login_form hook to be actually in the login form. - Fix message_details plugin ability to save a raw message. - Try better to get the filename of an attachment. + - Deliver_SMTP class now uses HTTP_HOST in SMTP HELO. Should fix DNS + issues some people have reported. (Closes #560524) Version 1.4.0 RC 1 ------------------ diff --git a/class/deliver/Deliver_SMTP.class.php b/class/deliver/Deliver_SMTP.class.php index 7e04fed0..546d612c 100644 --- a/class/deliver/Deliver_SMTP.class.php +++ b/class/deliver/Deliver_SMTP.class.php @@ -49,11 +49,19 @@ class Deliver_SMTP extends Deliver { if ($this->errorCheck($tmp, $stream)) { return(0); } - + + /* If $_SERVER['HTTP_HOST'] is set, use that in our HELO to the SMTP + server. This should fix the DNS issues some people have had */ + if (sqgetGlobalVar('HTTP_HOST', $HTTP_HOST, SQ_SERVER)) { // HTTP_HOST is set + $helohost = $HTTP_HOST; + } else { // For some reason, HTTP_HOST is not set - revert to old behavior + $helohost = $domain; + } + /* Lets introduce ourselves */ if (( $smtp_auth_mech == 'cram-md5') or ( $smtp_auth_mech == 'digest-md5' )) { // Doing some form of non-plain auth - fputs($stream, "EHLO $domain\r\n"); + fputs($stream, "EHLO $helohost\r\n"); $tmp = fgets($stream,1024); if ($this->errorCheck($tmp,$stream)) { return(0); @@ -99,14 +107,14 @@ class Deliver_SMTP extends Deliver { // CRAM-MD5 and DIGEST-MD5 code ends here } elseif ($smtp_auth_mech == 'none') { // No auth at all, just send helo and then send the mail - fputs($stream, "HELO $domain\r\n"); + fputs($stream, "HELO $helohost\r\n"); $tmp = fgets($stream, 1024); if ($this->errorCheck($tmp, $stream)) { return(0); } } elseif ($smtp_auth_mech == 'login') { // The LOGIN method - fputs($stream, "EHLO $domain\r\n"); + fputs($stream, "EHLO $helohost\r\n"); $tmp = fgets($stream, 1024); if ($this->errorCheck($tmp, $stream)) { return(0); -- 2.25.1