Part I: Learning the SMTP Protocol

Before you can create the E-mail component in this project, you must understand a little about the Simple Mail Transfer Protocol (SMTP) used to send mail on the Internet. SMTP is a clear text protocol that functions through a series of commands and responses exchanged between the e-mail client and server. Before automating the process, investigate this protocol by sending e-mail manually, using an application named Telnet.


NOTE: You will need direct access to an SMTP server. This project assumes that you are using Exchange 5.0 as your Internet mail server. Other servers might function slightly differently.

Sending e-mail does not require a complicated piece of client software. In fact, every computer running Microsoft Windows has a built-in network client, Telnet, which allows you to interact with a server by typing in commands.

Step 1

Start Telnet by choosing Run from the Start menu and typing the command Telnet. The Telnet application window appears, as shown in Figure 9-1.

Figure 9-1. The Telnet application.

Once Telnet is started, connect to your e-mail server by choosing Remote System from the Connect menu. In the Connect dialog box, provide the following information:

Host Name: [Your Server IP Address]

Port: 25

Click the Connect button. After a few moments, the server should respond with this message:

220 [Your Server Name] Microsoft Exchange Internet Mail Service 5.0.1457

Step 2

You are now communicating with the server. To see your instructions to the server, choose Preferences from the Terminal menu. In the Terminal Preferences dialog box, check the Local Echo option and click OK.

Step 3

Begin your e-mail transmission by typing the e-mail address of the sender and pressing enter:

MAIL FROM: [Sender's E-Mail Address]{ENTER}

The server should respond:

250 OK - mail from <[Sender's E-Mail Address]>

Step 4

Type the recipient's address, and press enter:

RCPT TO: [Recipient's E-Mail Address]{ENTER}

The server should respond:

250 OK - Recipient <[Recipient's E-Mail Address]>

Step 5

To tell the server that you are ready to send the body of your message, type the following:

DATA{ENTER}

The server should respond:

354 Send Data. End with CRLF.CRLF

Step 6

Type the body of your message line by line with a carriage return at the end of each line. The server recognizes that your message is complete when you send a period on a line by itself.

For example, to send a test message, type the following into Telnet:

DATE: [Today's Date in dd/mm/yy Format]{ENTER}

FROM: [Sender's Name]{ENTER}

TO: [Recipient's Name]{ENTER}

SUBJECT: Telnet Test!{ENTER}

{ENTER}

This is an e-mail test from Telnet!{ENTER}

.{ENTER}

Don't forget the period on the last line. The server will respond with the following:

250 OK

Step 7

Your message has been sent. Close Telnet by choosing Disconnect and then Exit from the Connect menu.

Step 8

Open your e-mail package, and check for your message!



Programming Active Server Pages
Programming Active Server Pages (Microsoft Programming Series)
ISBN: 1572317000
EAN: 2147483647
Year: 1996
Pages: 84

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net