To understand the different jobs that sendmail performs, you need to know a little about Internet protocols. Protocols are simply agreed-upon standards that software and hardware use to communicate.
Protocols are usually layered, with higher levels using the lower ones as building blocks. For example, the Internet Protocol (IP) sends packets of data back and forth without building an end-to-end connection such as used by SMTP and other higher-level protocols. The Transmission Control Protocol (TCP), which is built on top of IP, provides for connection-oriented services such as those used by programs such as Telnet and the Simple Mail Transfer Protocol (SMTP). Together, TCP/IP provides the basic network services for the Internet. Higher-level protocols such as the File Transfer Protocol (FTP)
and SMTP are built on top of TCP/IP. The advantage of such layering is that programs which implement the SMTP or FTP protocols don't have to know anything about transporting packets on the network and making connections to other hosts. They can use the services provided by TCP/IP for that job.
SMTP defines how programs exchange e-mail on the Internet. It doesn't matter whether the program exchanging the e-mail is sendmail running on an HP workstation or an SMTP client written for an Apple Macintosh. As long as both programs implement the SMTP protocol correctly, they can exchange mail.
The following example of the SMTP protocol in action might help demystify it a little. The user betty at gonzo.gov is sending mail to joe at whizzer.com:
$ sendmail -v [email protected] < letter
[email protected]... Connecting to whizzer.com via tcp... Trying 220.127.116.11... connected.
220-whizzer.com SMTP ready at Mon, 6 Jun 1997 18:56:22 -0500 22 0 ESMTP spoken here >>> HELO gonzo.gov
250 <[email protected]>... Recipient ok >>> DATA
354 Enter mail, end with "." on a line by itself
250 SAA08680 Message accepted for delivery
221 whizzer.com closing connection
[email protected]... Sent $
The first line shows one way to invoke sendmail directly rather than let your favorite Mail User Agent (MUA) such as Elm, Pine, or Mutt do it for you. The -v option tells sendmail to be verbose and shows you the SMTP dialogue. The other lines show an SMTP client and server carrying on a conversation. Lines prefaced with >>> indicate the client (or sender) on gonzo.gov, and the lines that immediately follow are the replies of the server (or receiver) on whizzer.com. The first line beginning with 220 is the SMTP server announcing itself after the initial connection, giving its hostname and the date and time, and the second line informs the client that this server understands the Extended SMTP protocol (ESMTP) in case the client wants to use it. Numbers such as 220 are reply codes that the SMTP client uses to communicate with the SMTP server. The text following the reply codes is only for human consumption.
Although this dialogue might still look a little mysterious, it will soon be very familiar if you take the time to read RFC 821. Running sendmail with its -v option also helps you understand how an SMTP dialogue works.
Was this article helpful?