projects
/
org.ibex.mail.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
5ba029e
)
use attempt rather than accept in SMTP errors
author
adam
<adam@megacz.com>
Sat, 15 Apr 2006 05:46:57 +0000
(
05:46
+0000)
committer
adam
<adam@megacz.com>
Sat, 15 Apr 2006 05:46:57 +0000
(
05:46
+0000)
darcs-hash:
20060415054657
-5007d-
2ae3cf78164ea9f3b63265ae8e1b72ab3219379e
.gz
src/org/ibex/mail/protocol/SMTP.java
patch
|
blob
|
history
diff --git
a/src/org/ibex/mail/protocol/SMTP.java
b/src/org/ibex/mail/protocol/SMTP.java
index
1ba2090
..
0e122ab
100644
(file)
--- 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) {
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) {
}
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<mx.length; i++) {
//if (deadHosts.contains(mx[i])) continue;
}
for(int i=0; i<mx.length; i++) {
//if (deadHosts.contains(mx[i])) continue;
@@
-259,9
+270,9
@@
public class SMTP {
Log.warn(SMTP.Outgoing.class, e);
if (e.code >= 500 && e.code <= 599) {
try {
Log.warn(SMTP.Outgoing.class, e);
if (e.code >= 500 && e.code <= 599) {
try {
- accept(m.bounce("unable to deliver: " + e));
+ attempt(m.bounce("unable to deliver: " + e), true);
} catch (Exception ex) {
} 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;
Log.error(SMTP.Outgoing.class, ex);
}
return true;