Commit 4dbf1f032f44ffa6b62b2d4604d775167941f5f8
1 parent
a895f9a2
send_mail: connections refused before EHLO with 550 error are no more considered…
… as fatal, but are converted to 432 temporary error.
Showing
1 changed file
with
27 additions
and
17 deletions
Show diff stats
calexium_lib/mail/send_mail.anubis
| ... | ... | @@ -225,22 +225,29 @@ define Reply_Result |
| 225 | 225 | { |
| 226 | 226 | failure then logError(send_mail_log, "send_ehlo: error sending EHLO"); error, |
| 227 | 227 | success(_) then |
| 228 | - with rep = receive_reply(conn), | |
| 229 | - if rep is | |
| 230 | - { | |
| 231 | - error then logError(send_mail_log, "send_ehlo: can't get reply"); error, | |
| 232 | - reply(code, lines) then | |
| 233 | - //we manage the 500 error, that mean the remote server is not ESMTP | |
| 234 | - //hence we try we with HELO, the old manner RFC 821 | |
| 235 | - if code = 500 | code = 502 then | |
| 236 | - if smtp_send_line(conn,"HELO "+our_host_name) is | |
| 237 | - { | |
| 238 | - failure then logError(send_mail_log, "send_ehlo: error sending HELO"); error, | |
| 239 | - success(_) then receive_reply(conn) | |
| 240 | - } | |
| 241 | - else | |
| 242 | - rep | |
| 243 | - } | |
| 228 | + with rep = if receive_reply(conn) is | |
| 229 | + { | |
| 230 | + error then logError(send_mail_log, "send_ehlo: can't get reply"); error, | |
| 231 | + reply(code, lines) then | |
| 232 | + //we manage the 500 error, that mean the remote server is not ESMTP | |
| 233 | + //hence we try we with HELO, the old manner RFC 821 | |
| 234 | + if code = 500 | code = 502 then | |
| 235 | + if smtp_send_line(conn,"HELO "+our_host_name) is | |
| 236 | + { | |
| 237 | + failure then logError(send_mail_log, "send_ehlo: error sending HELO"); error, | |
| 238 | + success(_) then receive_reply(conn) | |
| 239 | + } | |
| 240 | + else | |
| 241 | + reply(code, lines) | |
| 242 | + }, | |
| 243 | + if rep is reply(code, lines) then | |
| 244 | + if code = 550 then // some server simply refuse us because it's temporary overloaded (especially try when sending mailings) | |
| 245 | + logDebug(send_mail_log, "Converting a 550 error for EHLO to a 432 error as distant server may be temporary overloaded."); | |
| 246 | + reply(432, lines) | |
| 247 | + else | |
| 248 | + rep | |
| 249 | + else | |
| 250 | + rep | |
| 244 | 251 | }. |
| 245 | 252 | |
| 246 | 253 | The same one for 'MAIL FROM': |
| ... | ... | @@ -538,9 +545,12 @@ public define SendMailResult |
| 538 | 545 | else |
| 539 | 546 | reply_handling(code,lines,true) |
| 540 | 547 | } |
| 541 | - else | |
| 548 | + else if code = 550 then | |
| 542 | 549 | //some server answer "550 5.7.1 Client host rejected: cannot find your reverse hostname, [88.181.64.17]" |
| 543 | 550 | //before anything, then we try to extract the enhanced status if exists for relaying the mail with the ISP |
| 551 | + logDebug(send_mail_log, "Converting a 550 error for connection to a 432 error as distant server may be temporary overloaded."); | |
| 552 | + reply_handling(432,lines,true) | |
| 553 | + else | |
| 544 | 554 | reply_handling(code,lines,true) |
| 545 | 555 | }. |
| 546 | 556 | ... | ... |