While searching for a way to send an email from Python code, I have stumbled upon the following:
when I am doing an MX lookup with host -t mx gmail.com
command (which I've "borrowed" from this answer), I am getting the following:
gmail.com mail is handled by 5 gmail-smtp-in.l.google.com.
gmail.com mail is handled by 30 alt3.gmail-smtp-in.l.google.com.
gmail.com mail is handled by 20 alt2.gmail-smtp-in.l.google.com.
gmail.com mail is handled by 10 alt1.gmail-smtp-in.l.google.com.
gmail.com mail is handled by 40 alt4.gmail-smtp-in.l.google.com.
Non of this servers are mentioned in the official gmail docs (the ones that are there: smtp-relay.gmail.com
, smtp.gmail.com
, aspmx.l.google.com
). My understanding was that MX lookup should return address of the server (or list of them), which is responsible for handling mails for the domain.
My questions are:
- Why none of the smtps mentioned in the docs are returned by MX lookup?
- Which servers exactly are returned by MX lookup?
- Can servers returned by MX lookup be used to send an email to the domain emails (gmail in this case)?
- Can servers returned by MX lookup be used to send an email to an arbitrary domain email?
- If answer is "yes", to any of two previous questions — what authentication is required to use these servers?