I am trying to verify the email address of the user.
When trying to connect to the user's host using MX record I always get a 'Network is unreachable' error on the AWS EC2 instance. However, it works perfectly fine locally.
records = dns.resolver.query(domain, 'MX')
mx_record = records[0].exchange
mx = str(mx_record)
smtp_server = smtplib.SMTP(host=mx)
If I try to use:
smtp_server = smtplib.SMTP_SSL(host=mx, port=465)
I get the same issue.
Please share any ideas. Thanks!