From 6f8e6026b5d35a3fa41a124032caed6621a9f86e Mon Sep 17 00:00:00 2001 From: MegaBrutal Date: Sun, 8 Feb 2015 06:35:58 +0100 Subject: [PATCH] Fall back to HELO when remote server doesn't understand EHLO modified: MgSMTP.pas modified: Relay.pas modified: todo.txt --- MgSMTP.pas | 2 +- Relay.pas | 12 ++++++++++-- todo.txt | 3 ++- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/MgSMTP.pas b/MgSMTP.pas index 3e6ddfb..181d969 100644 --- a/MgSMTP.pas +++ b/MgSMTP.pas @@ -49,7 +49,7 @@ const document what bugfix/feature are you testing with the actual build. This will be logged to help you differentiate outputs of subsequent builds in your logs. If left empty, it won't be added to the logs. } - DEVCOMMENT = 'Escaping dots'; + DEVCOMMENT = 'EHLO->HELO fallback'; var diff --git a/Relay.pas b/Relay.pas index 1e42979..cea792d 100644 --- a/Relay.pas +++ b/Relay.pas @@ -377,7 +377,14 @@ begin end; Result:= true; end - else AdministerMassFailure(Result); + else if (Response.GetNumericCode >= 500) and (Response.GetNumericCode <= 504) then begin + { It seems the remote site did not understand our EHLO, that is, + let's admit, quite odd in the 21st century... + Whatever, let's fall back to RFC 821 then. } + TCP.SendCommand(SMTP_C_HELO, MainServerConfig.Name); + TCP.ReadResponse(Response); + Result:= Response.GetNumericCode = SMTP_R_OK; + end; if Result then begin if FRoutingTarget.Auth then begin @@ -408,7 +415,8 @@ begin else Authenticated:= true; if not Authenticated then AdministerMassFailure(Result); - end; + end + else AdministerMassFailure(Result); end else AdministerMassFailure(Result); diff --git a/todo.txt b/todo.txt index 3c871a0..58ac308 100644 --- a/todo.txt +++ b/todo.txt @@ -27,8 +27,9 @@ v0.9t: - Bind to user-specified IPs + Option to add Reply-To header to forwarded e-mails + Fix non-RFC-compliant handling of lines starting with dots -- Fall back to HELO when remote server doesn't support EHLO ++ Fall back to HELO when remote server doesn't support EHLO - Implement CHUNKING extension +- Implement more proper reactions for non-standard replies and sequence breaking v0.9s: + Change "Client disconnected, and thread exited successfully." to "Client disconnected." -- 2.34.1