From 4dbf1f032f44ffa6b62b2d4604d775167941f5f8 Mon Sep 17 00:00:00 2001 From: Cedric RICARD Date: Fri, 16 Jan 2009 22:11:54 +0000 Subject: [PATCH] send_mail: connections refused before EHLO with 550 error are no more considered as fatal, but are converted to 432 temporary error. --- calexium_lib/mail/send_mail.anubis | 44 +++++++++++++++++++++++++++----------------- 1 file changed, 27 insertions(+), 17 deletions(-) diff --git a/calexium_lib/mail/send_mail.anubis b/calexium_lib/mail/send_mail.anubis index aa8f57e..322549d 100644 --- a/calexium_lib/mail/send_mail.anubis +++ b/calexium_lib/mail/send_mail.anubis @@ -225,22 +225,29 @@ define Reply_Result { failure then logError(send_mail_log, "send_ehlo: error sending EHLO"); error, success(_) then - with rep = receive_reply(conn), - if rep is - { - error then logError(send_mail_log, "send_ehlo: can't get reply"); error, - reply(code, lines) then - //we manage the 500 error, that mean the remote server is not ESMTP - //hence we try we with HELO, the old manner RFC 821 - if code = 500 | code = 502 then - if smtp_send_line(conn,"HELO "+our_host_name) is - { - failure then logError(send_mail_log, "send_ehlo: error sending HELO"); error, - success(_) then receive_reply(conn) - } - else - rep - } + with rep = if receive_reply(conn) is + { + error then logError(send_mail_log, "send_ehlo: can't get reply"); error, + reply(code, lines) then + //we manage the 500 error, that mean the remote server is not ESMTP + //hence we try we with HELO, the old manner RFC 821 + if code = 500 | code = 502 then + if smtp_send_line(conn,"HELO "+our_host_name) is + { + failure then logError(send_mail_log, "send_ehlo: error sending HELO"); error, + success(_) then receive_reply(conn) + } + else + reply(code, lines) + }, + if rep is reply(code, lines) then + if code = 550 then // some server simply refuse us because it's temporary overloaded (especially try when sending mailings) + logDebug(send_mail_log, "Converting a 550 error for EHLO to a 432 error as distant server may be temporary overloaded."); + reply(432, lines) + else + rep + else + rep }. The same one for 'MAIL FROM': @@ -538,9 +545,12 @@ public define SendMailResult else reply_handling(code,lines,true) } - else + else if code = 550 then //some server answer "550 5.7.1 Client host rejected: cannot find your reverse hostname, [88.181.64.17]" //before anything, then we try to extract the enhanced status if exists for relaying the mail with the ISP + logDebug(send_mail_log, "Converting a 550 error for connection to a 432 error as distant server may be temporary overloaded."); + reply_handling(432,lines,true) + else reply_handling(code,lines,true) }. -- libgit2 0.21.4