Sending an email process

0

I'm trying to understand in detail how does email work. I've found a pretty good site (MX Record in DNS Explained with Example Configurations) describing the topic. Unfortunately there is some confusion i have. Here is what the site tells about sending an email:

Once your SMTP server finds the target receivers SMTP server, using an MX record lookup, it will forward the message to that server (through the internet ). Then the SMTP server will forward the message to POP or IMAP server responsible for the domain...

Say I'd like to send an email from john@yahoo.com to marry@gmail.com. According to the above statement my MUA (mutt in my case) sends the message to my SMTP server (which is smtp.mail.yahoo.com). Then smtp.mail.yahoo.com use DNS lookup to get MX record for gmail.com domain. As i checked the MX record for gmail.com is gmail-smtp-in.l.google.com with IP: 173.194.77.26. From other side the address of gmail SMTP serer (smtp.gmail.com) is: 173.194.77.108. And here is the confusion.

  1. Shouldn't the above two addresses be the same (as i understand from the cited excerpt)? Why does the MX lookup returns reference to different machine then the smtp.gmail.com is?
  2. Does it mean that the smtp.mail.yahoo.com forwards the message to gmail-smtp-in.l.google.com and if so what smtp.gmail.com have to do in the process?
  3. Where is the marry mailbox account hosted? At gmail-smtp-in.l.google.com, smtp.gmail.com or maybe imap.gmail.com serer?

Mulligan

Posted 2017-02-02T15:44:41.513

Reputation: 533

Answers

2

In and outgoing SMTP for a provider may be handled by different servers.

  • Incoming SMTP (or often called MX) handles incoming mail for the users of the domain. These servers will be configured to only accept mail destined for their own domain (gmail.com for example).

  • Outgoing SMTP handles mail for users of the domain who try to send email to the rest of the world. These servers will be configured to allow mail destined for everywhere, but only if it is send by their own customers. Often this is enforced with firewalls based on IP address or SMTP AUTH (username and password).

If you send a mail from yahoo.com to google.com, smtp.gmail.com will do nothing. However, if you send a mail from google.com to yahoo.com, the smtp.google.com server will accept the mail from the MUA and send it to yahoo.com's MX server.

For your last question, the marry mailbox will probably be hosted on some server far away in the Google cloud. When a front-end (one of the servers that handles imap.google.com) gets a request to serve files from the marry mailbox, it'll look up a reference to the mailbox (in some database) and retrieve the information from a remote machine.

Thinking about huge mail setups (like yahoo.com and gmail.com) is maybe not the best way to start understanding mail. Try to understand how your ISP would handle it.

mtak

Posted 2017-02-02T15:44:41.513

Reputation: 11 805

Am i right that taking what You said reciver smtp (gmail-smtp-in.l.google.com) forwards the message to the mailbox hosting serwer in cloud and this is the last step in the email sending procesów. Now when the reciver wants to get a new message it just asks its imap serwer (imap.gmail.com) which then asks mentioned mailbox hosting serwer for the message in question? – Mulligan – 2017-02-02T23:17:31.847

Indeed, you're right. The last part of the process is not part of email standards, and can be done with SMTP, LMTP or some propietary protocol (like MS Exchange does). Probably Google would have built something propietary for this. – mtak – 2017-02-03T07:27:52.063