Unix Network Admin   «Prev  Next»
Lesson 5SMTP and sendmail
ObjectiveDescribe how sendmail uses the SMTP protocol to forward email across the Internet.

How Sendmail uses the SMTP protocol to forward email

The sendmail agent uses the Simple Mail Transport Protocol (SMTP) to forward email across the Internet. SMTP is an application-layer Internet protocol. It, and other aspects of the Internet email system, is described in a series of Request for Comments documents (RFCs). You can obtain RFCs free of charge from many locations, including the RFC Editor Homepage.

Email RFCs

Some of the more important RFC documents pertaining to email are RFC 821, 822, and 1123. RFC 821 specifies that the Simple Mail Transfer Protocol (SMTP) uses port 25, that its primary transport protocol is TCP, and several other requirements. RFC 822 determines how MUAs, MDAs and MTAs format and send email. Among other things, RFC 1123 contains a helpful discussion of the requirements for Internet-enabled email hosts. Even if you use a completely different MTA than sendmail, you are implementing the principles set out in these three documents.

An SMTP session using sendmail

220 mail.corporation.com ESMTP sendmail 8.9.3; Tue, 13 Jul 1999
14:04:19 -
0700
Helo linuxhost.corporation.com
250 linuxhost.corporation.com Hello [105.15.47.34], pleased to meet you
Mail From: [email protected]
250 [email protected]... Sender ok
RCPT To: [email protected]
250 [email protected]... Recipient ok
Data
354 Enter mail, end with "." on a line by itself
From: [email protected]
To: [email protected]
Message ...
.
250 OAA00328 Message accepted for delivery
							

Click the View Example button to examine an example of a simple SMTP session. The linuxhost box is sending an SMTP mail message via mail.corporation.com to a remote host ([email protected]). The message is from user james on linuxhost.corporation.com ([email protected]), but
sendmail
will write the headers so that the message appears to come from [email protected]. his is an example of masquerading. Note also that ESMTP stands for “Extended” SMTP; this is a fancier version of the SMTP protocol in common use.
Received: from mail.corporation.com 
(106.52.55.47 [106.52.55.47]) by
mail.corporation2.com with SMTP (sendmail 8.8.9)
id NMCCV3MT; Tue, 13 Jul 1999 14:14:25 -0700
Received: from mail.corporation.com ([105.15.47.34])
by mail.corporation2.com (8.9.3) with SMTP 
id OAA00333
for sandi.corporation2.com; Tue, 13 Jul 1999 
14:14:27 -0700
Date: Tue, 13 Jul 1999 14:14:27 -0700
From: [email protected]
Message-Id: <199907132114.OAA00333@mail.
corporation.com>
Message ...

Once this session is completed, mail.corporation will forward the message to [email protected]. Numbers such as 220 and 250 indicate RFC 821 success messages. Click the View Example button to examine the RFC 822 header information contained in the email message received by [email protected]. This session shown in the example was successful because mail.corporation.com relays messages from linuxhost.corporation.com, then routes it to mail.corporation2.com. Notice that the headers have changed. This is because the linuxhost sendmail daemon used masquerading. This enabled sendmail to rewrite the headers during transmission to make the [email protected] address appear as [email protected].
You will learn more about how to configure your sendmail daemon in upcoming lessons.