public static final int GRAYLIST_MINWAIT = 1000 * 60 * 60; // one hour
public static final int GRAYLIST_MAXWAIT = 1000 * 60 * 60 * 24 * 5; // five days
+ public static final int RETRY_TIME = 1000 * 60 * 30;
+
public static final Graylist graylist;
public static final Whitelist whitelist;
static {
private int serial = serials++;
private Mailbox.Iterator it;
+ private static Map<String,Long> nextTry = Collections.synchronizedMap(new HashMap<String,Long>());
+
public Outgoing() {
synchronized(Outgoing.class) {
threads.add(this);
}
if (!good) break;
try {
- if (attempt(it.cur())) it.delete();
+ String messageid = it.cur().messageid;
+ if (nextTry.get(messageid) == null || System.currentTimeMillis() > nextTry.get(messageid)) {
+ boolean ok = attempt(it.cur());
+ if (ok) it.delete();
+ else nextTry.put(messageid, System.currentTimeMillis() + RETRY_TIME);
+ }
} catch (Exception e) {
Log.error(SMTP.Outgoing.class, e);
}