If you want to write PHP scripts that handle email, there are a few things you need to understand first. This article, the first of two parts, introduces you to these concepts. It is excerpted from chapter 8 of the Zend PHP Certification Study Guide, written by Zend Technologies (Sams; ISBN: 0672327090).
When an MTA has an email message to send to another MTA, it has to convert the address in the To:, Cc:, or Bcc: line into an IP address. Everything after the @ sign in the address is taken to be the email domain. This is normally something such as @php.net.
The email domain isn't the real name of a server. It looks like a real name (and has to follow the same rules), but it isn't. It's actually a special kind of DNS alias.
To receive email for your email domain, you have to add an MX record for that email domain to your DNS server.
Note - If you don't set up an MX record in your DNS server, the MTA will look for a matching A record instead.
MUA—Mail User Agent
The Mail User Agent (MUA) is the jargon name for an email client.
Examples of Mail User Agents are
Outlook Express
Evolution
KMail
pine
mutt
Hotmail
A PHP script that sends email is also a type of Mail User Agent.
Mail User Agents read email directly from files on disk, via network protocols such as POP3 or IMAP, or via proprietary network protocols (as used by Microsoft Exchange).
Mail User Agents normally send their email by connecting to a Mail Transport Agent over the network via the SMTP network protocol. Some UNIX-based Mail User Agents might send their email instead by executing a sendmail wrapper program.
When a Mail User Agent connects to an MTA via SMTP to send email, it might use SASL to authenticate the user.
SASL—Simple Authentication and Security Layer
The Simple Authentication and Security Layer (SASL) is a tried and trusted way to bolt user-authentication onto existing network protocols. SMTP has been extended (via the SMTP AUTH command) to support SASL.
If an MTA has been configured to require authentication, only MUAs with built-in support for the SMTP AUTH command will be able to connect to send email.