X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Forg%2Fibex%2Fmail%2FWhitelist.java;fp=src%2Forg%2Fibex%2Fmail%2FWhitelist.java;h=1fe679ec1c35003e7ec668887de7e99356925f0a;hb=c82a5fe807663d963843afcd00d9eeb892db8655;hp=06724fed9d1f5244bc43a44c9fecc090c1209667;hpb=5411caaf7161d1904eed4e9b3aa776920bd8671d;p=org.ibex.mail.git diff --git a/src/org/ibex/mail/Whitelist.java b/src/org/ibex/mail/Whitelist.java index 06724fe..1fe679e 100644 --- a/src/org/ibex/mail/Whitelist.java +++ b/src/org/ibex/mail/Whitelist.java @@ -115,6 +115,7 @@ public class Whitelist { public synchronized void challenge(Message m) { try { Log.warn(Whitelist.class, "challenging message: " + m.summary()); + Address to = m.headers.get("reply-to")==null ? null : Address.parse(m.headers.get("reply-to")); if (to==null) to = m.from; if (to==null) to = m.envelopeFrom; @@ -186,8 +187,16 @@ public class Whitelist { " http://www.templetons.com/brad/spam/crgood.html\n"; Message challenge = Message.newMessage(new Fountain.StringFountain(message)); - if (!SMTP.Outgoing.attempt(challenge)) - throw new RuntimeException("attempted to send challenge but could not: " + m.summary()); + + PreparedStatement query = conn.prepareStatement("select email from pending where email=?"); + query.setString(1, to.toString(false)); + ResultSet rs = query.executeQuery(); + if (rs.next()) { + Log.warn(this, "already challenged " + to.toString(false) + "; not challenging again."); + } else { + if (!SMTP.Outgoing.attempt(challenge)) + throw new RuntimeException("attempted to send challenge but could not: " + m.summary()); + } PreparedStatement add = conn.prepareStatement("insert into pending values(?,?,?,?)"); add.setString(1, messageid);