Skip to content
Snippets Groups Projects
Commit d289822f authored by Stuart Gathman's avatar Stuart Gathman
Browse files

Handle DNS error sending DSN.

parent 806aa5a6
No related branches found
No related tags found
No related merge requests found
...@@ -9,7 +9,7 @@ import milter ...@@ -9,7 +9,7 @@ import milter
import thread import thread
from milter import ACCEPT,CONTINUE,REJECT,DISCARD,TEMPFAIL, \ from milter import ACCEPT,CONTINUE,REJECT,DISCARD,TEMPFAIL, \
set_flags, setdbg, setbacklog, settimeout, \ set_flags, setdbg, setbacklog, settimeout, error, \
ADDHDRS, CHGBODY, ADDRCPT, DELRCPT, CHGHDRS, \ ADDHDRS, CHGBODY, ADDRCPT, DELRCPT, CHGHDRS, \
V1_ACTS, V2_ACTS, CURR_ACTS V1_ACTS, V2_ACTS, CURR_ACTS
......
...@@ -5,6 +5,9 @@ ...@@ -5,6 +5,9 @@
# Send DSNs, do call back verification, # Send DSNs, do call back verification,
# and generate DSN messages from a template # and generate DSN messages from a template
# $Log$ # $Log$
# Revision 1.13 2007/01/04 18:01:11 customdesigned
# Do plain CBV when template missing.
#
# Revision 1.12 2006/07/26 16:37:35 customdesigned # Revision 1.12 2006/07/26 16:37:35 customdesigned
# Support timeout. # Support timeout.
# #
...@@ -28,8 +31,11 @@ def send_dsn(mailfrom,receiver,msg=None,timeout=600): ...@@ -28,8 +31,11 @@ def send_dsn(mailfrom,receiver,msg=None,timeout=600):
Receiver is the MTA sending the DSN. Receiver is the MTA sending the DSN.
Return None for success or (code,msg) for failure.""" Return None for success or (code,msg) for failure."""
user,domain = mailfrom.split('@') user,domain = mailfrom.split('@')
try:
q = spf.query(None,None,None) q = spf.query(None,None,None)
mxlist = q.dns(domain,'MX') mxlist = q.dns(domain,'MX')
except spf.TempError:
return (450,'DNS Timeout: %s MX'%domain) # temp error
if not mxlist: if not mxlist:
mxlist = (0,domain), # fallback to A record when no MX mxlist = (0,domain), # fallback to A record when no MX
else: else:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment