mirror of
https://github.com/mail-in-a-box/mailinabox.git
synced 2024-11-26 02:57:04 +00:00
Now supports domains with multiple MX records.
The status check on MX records now correctly handles domains with multiple MX records.
This commit is contained in:
parent
ead6f96513
commit
b2fcd4c9e5
@ -416,10 +416,17 @@ def check_dnssec(domain, env, output, dns_zonefiles, is_checking_primary=False):
|
|||||||
def check_mail_domain(domain, env, output):
|
def check_mail_domain(domain, env, output):
|
||||||
# Check the MX record.
|
# Check the MX record.
|
||||||
|
|
||||||
mx = query_dns(domain, "MX", nxdomain=None)
|
|
||||||
recommended_mx = "10 " + env['PRIMARY_HOSTNAME']
|
recommended_mx = "10 " + env['PRIMARY_HOSTNAME']
|
||||||
|
mx = query_dns(domain, "MX", nxdomain=None)
|
||||||
|
|
||||||
if mx == None:
|
if mx is None:
|
||||||
|
mxhost = None
|
||||||
|
else:
|
||||||
|
# query_dns returns a semicolon-delimited list
|
||||||
|
# of priority-host pairs.
|
||||||
|
mxhost = mx.split('; ')[0].split(' ')[1]
|
||||||
|
|
||||||
|
if mxhost == None:
|
||||||
# A missing MX record is okay on the primary hostname because
|
# A missing MX record is okay on the primary hostname because
|
||||||
# the primary hostname's A record (the MX fallback) is... itself,
|
# the primary hostname's A record (the MX fallback) is... itself,
|
||||||
# which is what we want the MX to be.
|
# which is what we want the MX to be.
|
||||||
@ -439,10 +446,10 @@ def check_mail_domain(domain, env, output):
|
|||||||
be delivered to this box. It may take several hours for public DNS to update after a
|
be delivered to this box. It may take several hours for public DNS to update after a
|
||||||
change. This problem may result from other issues listed here.""" % (recommended_mx,))
|
change. This problem may result from other issues listed here.""" % (recommended_mx,))
|
||||||
|
|
||||||
elif mx.split(' ')[1] == recommended_mx.split(' ')[1]:
|
elif mxhost == env['PRIMARY_HOSTNAME']:
|
||||||
good_news = "Domain's email is directed to this domain. [%s => %s]" % (domain, mx)
|
good_news = "Domain's email is directed to this domain. [%s => %s]" % (domain, mx)
|
||||||
if mx != recommended_mx:
|
if mx != recommended_mx:
|
||||||
good_news += " However, the usage of a non-standard priority value ('%s') is not recommended." % mx.split(' ')[0]
|
good_news += " This configuration is non-standard. The recommended configuration is '%s'." % (recommended_mx,)
|
||||||
output.print_ok(good_news)
|
output.print_ok(good_news)
|
||||||
else:
|
else:
|
||||||
output.print_error("""This domain's DNS MX record is incorrect. It is currently set to '%s' but should be '%s'. Mail will not
|
output.print_error("""This domain's DNS MX record is incorrect. It is currently set to '%s' but should be '%s'. Mail will not
|
||||||
|
Loading…
Reference in New Issue
Block a user