Describing the Basic SMTP Dialogs
As a user, you are undoubtedly familiar with MUAs and what they do for you, but you may be unsure as to how they work. When you create a mail message using an MTA. As you create the message, you provide content as well as address information and your own identity. When you finally send the message, the MUA opens a TCP connection with your outgoing MTA.
Your outgoing MTA server communicates with your MUA using SMTP. The MTA listens for a TCP connection on port 25. After your MUA connects, it starts a command dialog according to the SMTP specification. Indicating the sender of the message rather than the targeted recipient accomplishes this. (At this point, the MTA can deny access based on the identity of the user sending the message.)
By employing a set of rules based on domain names or IP addresses, messages can be filtered and not relayed any further
. This prevents unauthorized users, such as hackers, from using your MTA as a free on-ramp to the Internet. Any size installation should definitely have this ability. If you do not, you may be subject to intolerable amounts of spam and junk mail.
After the identity of the client is verified, the client machine tells the MTA the destination address or addresses. The MTA can then respond to each address and either deny or allow transmission to that address. If the address is not local, the MTA will respond with an appropriate error code and either forward the mail itself or allow the client to contact the destination MTA.
Here is a typical SMTP dialog between a client and an MTA:
MTA: 220 TEST.NWC.COM Simple Mail Transfer Service Ready
MUA: MAIL FROM:
MTA: 250 Sender OK
MUA: RCPT TO:
MTA: 250 Recipient OK
MUA: DATA
MUA: 354 Enter mail input; end with
.
MUA: This is a test message.
MUA: I will end this message with a period all by itself.
MUA: .
MTA: 250 OK
MUA: QUIT
MTA: 221 TEST.NWC.COM closing connection.
If a client machine wanted to send this message to more than one person, there would simply be more than one RCPT command, indicating additional destination addresses. Similarly, more than one message can be sent per SMTP dialog. To send additional messages, the MUA would not issue the QUIT command until it was done sending all of its mail. For each message, a line with nothing but a period and a carriage return indicates the end of the message body.
When a mail message is relayed from one MTA to another, the MAIL command also indicates the originating host. The following example shows the SMTP dialog between a relay host (TEST.NWC.COM) and the destination host (OZ.COM) that is relaying a message from FRED@SOMEWHERE.COM to WIZARD@OZ.COM.
MTA1: 220 oz.com Simple Mail Transfer Service Ready
MTA2: HELO test.nwc.com
MTA1: 250 oz.com
MTA2: MAIL FROM:
<
@test.nwc.com:fred@somewher
e.com>
MTA1: 250 OK
MTA2: RCPT TO:
MTA1: 250 OK
MTA2: DATA
...
MTA2: QUIT
To experience an SMTP dialog, any user can telnet into their SMTP server on port 25. You will find prompts similar to what we have described above. Take some time to become familiar with SMTP and how it works. In the event there is a problem with sending or receiving mail, knowing how SMTP works and what commands are necessary can oftentimes reveal the source of the problem with minimal effort.
Depending on what MTA you are using, you will have different security options. Sendmail, for example, allows you to restrict SMTP connections based on host name, domain name and IP addresses. Other packages allow further restriction based on recipient or destination address. Some MTAs go even further to screen the data portion of the mail message. For example, NTMail from Internet-Shopper can screen message content for forbidden words, preventing unsuitable material from entering your users' mailboxes. Available security options should be on your list of MTA features when considering your MTA options. Consider e-mail a security risk, and take steps now to prevent headaches later.

Print This Page
E-mail this URL
|