Mail

From LQWiki
(Redirected from E-mail)
Jump to navigation Jump to search

This page is about e-mail that can be sent or received. For the command mail, see Mail (command).

e-mail (SMTP-mail) is a concept that allows to send messages over the internet. There are some things you may want to understand before you set up a "mail server". This article gives an overview about the concepts involved in sending, receiving and displaying mail.

Here is an example story how Alice and Bob communicate via mail: Alice wants to write a mail to Bob. Alice uses kmail as mail program. kmail is her mail user agent, her MUA. She writes to Bob whose address is bob@home.org. Of course, the content of her mail is secret so we won't tell it here. After she clicks "send", her MUA transmits the mail to Alice's outgoing mail server. This server has a little program on it called sendmail. This program looks up home.org's MX record. You can do this on your own using the command

dig -t mx home.org

It uses the IP address that it gets and, using the IP protocol, sends Alice's mail there.

Ok, and at this IP address, the message transfer agent of home.org can be reached. This is a server that "speaks" the simple mail transfer protocol SMTP. It can receive mails, and also send them. It has also run on Alice's outgoing mail server. The smtp server receives the mail for Bob and puts it into his mailbox. Bob is asleep at the moment.

The next morning, Bob wakes up and uses his kmail to check his mail. kmail must know how it gets Bob's mailbox. There are two possibilities for that. Either Bob has a pop service running on his server where his mailbox is. In this case, kmail just fetches all mails from the mailbox and (optionally) deletes them. Or Bob has an imap service running there. In this case, Bob gets all mails displayed in his kmail, but they remain on the server. First when Bob presses "delete" in his mail program, the mails are deleted from the mailbox.

Bob can also collect his mails from his various mail accounts around the net. This is where fetchmail comes into the game.

This little story explains:

  • an MTA is responsible for sending and receiving mail
  • a MUA is responsible for displaying mail
  • for a MUA to be able to display mail, you still need an imap or pop server