The SMTP service component that you install with IIS 5.0 and IIS 4.0 facilitates the transmission of Internet mail. The SMTP service is perfect for sending mail automatically from your Web applications. However, the SMTP service sends mail: It doesn't receive it. POP3 servers, such as Microsoft Exchange Server, facilitate receiving Internet mail.

Although IIS doesn't include a POP3 service, a software developer can easily write one or modify an existing service. For example, a developer could modify the POP3 service sample that the Microsoft Win32 Platform software development kit (SDK) provides so that it uses the Collaboration Data Objects for Windows NT Server (CDONTS) Library to read mail based on a supplied username.

By default, you install the SMTP service when you install Windows 2000 and IIS 5.0. In NT 4.0, you can install the service by selecting either the typical or custom installation option of the Microsoft Windows NT 4.0 Option Pack. For a custom setup, the first dialog box that appears lets you select the components to install. In this dialog box, select Internet Information Server, then click Show Subcomponents to open the Internet Information Server dialog box. This dialog box displays IIS subcomponents, including the SMTP service. When you've made your component selections, click Next. A dialog box appears that prompts you for a mail root location. C:\inetpub\mailroot is the default location.

The SMTP service in IIS is completely directory based. The SMTP installation creates the following directory structure in the \inetpub\mailroot directory:

  • BADMAIL—This directory stores messages that the SMTP service can't deliver. Look here first when you're debugging problems related to the structural format of the mail messages.
  • DROP—This directory holds all mail for your SMTP service. Each file in this directory represents one email message. Unfortunately, you can't determine the name and address of the sender and receiver from the structure of the filename.
  • PICKUP—As soon as a mail message goes into this directory, the SMTP service picks it up and either delivers it to the Drop directory or sends it to the SMTP service for the destination domain.
  • QUEUE— If the SMTP service can't deliver a message immediately because of a network problem or other connectivity problem, the message queues in the Queue directory. The SMTP service holds the message for a configurable length of time, then tries to retransmit it a configurable number of times.
  • ROUTE, SORTTEMP, and MAILBOX—The SMTP service uses these directories to sort and rearrange outgoing messages so that it can make their delivery more efficient. If several messages are going to the same remote host, IIS tries to send them all by using a single connection instead of transmitting each one individually by reconnecting multiple times.

You can use Notepad to create a properly formatted email message, then copy the message to the Pickup directory. As soon as the message is in the Pickup directory, the IIS SMTP service tries to deliver it. Adding this feature to your Web applications makes sending mail as easy as creating a text file and copying it to the \mailroot\pickup directory.

To create a file for the \mailroot\pickup directory that the IIS SMTP service will deliver, use this format:

        x-sender: TimHuck@InterKnowlogy.com
                x-receiver: WoodyP@InterKnowlogy.com
                From: TimHuck@InterKnowlogy.com
                To: WoodyP@InterKnowlogy.com
                Subject: Test Email
This is a test. This is the body of the message.

Don't forget to insert a blank line between the header and the message text.