From: adam Date: Sun, 26 Feb 2006 04:07:55 +0000 (+0000) Subject: proper handling of SMTP 5xx messages X-Git-Url: http://git.megacz.com/?p=org.ibex.mail.git;a=commitdiff_plain;h=0704cf17772a0cfe704e8d379723e96137d7da95 proper handling of SMTP 5xx messages darcs-hash:20060226040755-5007d-2d7e863b0ca82a3a6f48df6f265a6ed491adc66b.gz --- diff --git a/src/org/ibex/mail/protocol/SMTP.java b/src/org/ibex/mail/protocol/SMTP.java index 32c25f6..18d49db 100644 --- a/src/org/ibex/mail/protocol/SMTP.java +++ b/src/org/ibex/mail/protocol/SMTP.java @@ -242,6 +242,21 @@ public class SMTP { Log.warn(SMTP.Outgoing.class, "success: " + mx + " accepted " + m.summary() + "\n["+resp+"]"); accepted = true; conn.close(); + } catch (SMTPException e) { + if (accepted) return true; + Log.warn(SMTP.Outgoing.class, " unable to send; error=" + e); + Log.warn(SMTP.Outgoing.class, " message: " + m.summary()); + Log.warn(SMTP.Outgoing.class, e); + if (e.code >= 500 && e.code <= 599) { + try { + accept(m.bounce("unable to deliver: " + e)); + } catch (Exception ex) { + Log.error(SMTP.Outgoing.class, "very serious: exception while trying to deliver bounce"); + Log.error(SMTP.Outgoing.class, ex); + } + return true; + } + return false; } catch (Exception e) { if (accepted) return true; Log.warn(SMTP.Outgoing.class, " unable to send; error=" + e);