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;
" 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);