Handle DNS error sending DSN.
This commit is contained in:
+1
-1
@@ -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
|
||||||
|
|
||||||
|
|||||||
+8
-2
@@ -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):
|
|||||||
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('@')
|
||||||
q = spf.query(None,None,None)
|
try:
|
||||||
mxlist = q.dns(domain,'MX')
|
q = spf.query(None,None,None)
|
||||||
|
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:
|
||||||
|
|||||||
Reference in New Issue
Block a user