From 73429dca1501729a79c2a004b1516172d8150665 Mon Sep 17 00:00:00 2001 From: adam Date: Sat, 15 Apr 2006 05:46:57 +0000 Subject: [PATCH] use attempt rather than accept in SMTP errors darcs-hash:20060415054657-5007d-2ae3cf78164ea9f3b63265ae8e1b72ab3219379e.gz --- src/org/ibex/mail/protocol/SMTP.java | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/src/org/ibex/mail/protocol/SMTP.java b/src/org/ibex/mail/protocol/SMTP.java index 1ba2090..0e122ab 100644 --- a/src/org/ibex/mail/protocol/SMTP.java +++ b/src/org/ibex/mail/protocol/SMTP.java @@ -178,19 +178,30 @@ public class SMTP { } } - public static boolean attempt(Message m) throws IOException { + public static boolean attempt(Message m) throws IOException { return attempt(m, false); } + public static boolean attempt(Message m, boolean noBounces) throws IOException { if (m.envelopeTo == null) { Log.warn(SMTP.Outgoing.class, "aieeee, null envelopeTo: " + m.summary()); return false; } InetAddress[] mx = getMailExchangerIPs(m.envelopeTo.host); if (mx.length == 0) { - accept(m.bounce("could not resolve " + m.envelopeTo.host)); - return true; + if (!noBounces) { + accept(m.bounce("could not resolve " + m.envelopeTo.host)); + return true; + } else { + Log.warn(SMTP.Outgoing.class, "could not resolve " + m.envelopeTo.host); + return false; + } } if (new Date().getTime() - m.arrival.getTime() > 1000 * 60 * 60 * 24 * 5) { - accept(m.bounce("could not send for 5 days")); - return true; + if (!noBounces) { + accept(m.bounce("could not send for 5 days")); + return true; + } else { + Log.warn(SMTP.Outgoing.class, "could not send for 5 days: " + m.summary()); + return false; + } } for(int i=0; i= 500 && e.code <= 599) { try { - accept(m.bounce("unable to deliver: " + e)); + attempt(m.bounce("unable to deliver: " + e), true); } catch (Exception ex) { - Log.error(SMTP.Outgoing.class, "very serious: exception while trying to deliver bounce"); + Log.error(SMTP.Outgoing.class, "exception while trying to deliver bounce; giving up completely"); Log.error(SMTP.Outgoing.class, ex); } return true; -- 1.7.10.4