The major issue with your patch is not all valid email domains have MX records. A valid email domain must have either an A record, an AAAA record or an MX record pointing to a host name with an A or AAAA record. E.g., a domain with an MX pointing to a host name with only a CNAME or MX is not a valid email domain, but a domain with only an A or AAAA record is a valid email domain. A domain which has a CNAME is a valid email domain as long as the CNAME directly or indirectly points to a host with an A, AAAA or MX as above. See RFC 5321, Sec 5.1.
Another issue is Mailman tries not to use bare except: clauses to catch exceptions. We prefer to catch only those explicit exceptions which might occur. I.e., in this case, explicitly only those exceptions that might be returned by dns.resolver.query.
The major issue with your patch is not all valid email domains have MX records. A valid email domain must have either an A record, an AAAA record or an MX record pointing to a host name with an A or AAAA record. E.g., a domain with an MX pointing to a host name with only a CNAME or MX is not a valid email domain, but a domain with only an A or AAAA record is a valid email domain. A domain which has a CNAME is a valid email domain as long as the CNAME directly or indirectly points to a host with an A, AAAA or MX as above. See RFC 5321, Sec 5.1.
Another issue is Mailman tries not to use bare except: clauses to catch exceptions. We prefer to catch only those explicit exceptions which might occur. I.e., in this case, explicitly only those exceptions that might be returned by dns.resolver.query.