Subscribe to Windows IT Pro
July 01, 1998 12:00 AM

Using the SMTP Service with IIS 4.0

Windows IT Pro
InstantDoc ID #3577
Rating: (0)
Making it easy for users to email you

Most Web sites and Web applications use some type of Internet mail feature so users can mail messages to the Web master or other individuals within an organization. To make this process easy and transparent, Microsoft has added a Simple Mail Transfer Protocol (SMTP) Mail Service to Internet Information Server (IIS) 4.0. The SMTP Service is an SMTP interface that includes everything you need to connect to a mail server. You can use it to connect to Microsoft Exchange Server or other mail servers with similar SMTP features.

After you set up the SMTP Service, you can configure and manage it according to your needs. SMTP Service also includes several tools to help you monitor and tune the server. Finally, you can take steps to secure the SMTP Service before you implement it.

Setup and Configuration
The SMTP Service is easy to set up. I was able to mail a message from a demonstration Active Server Pages (ASP) application in about 5 minutes. This performance was good considering I connected to a remote mail server in another state that I could access only over the Internet.

The first step in setting up the SMTP Service is to identify the mail server, such as Microsoft Exchange Server, that will process the mail. (For more, see Spyros Sakellariadis, "Using Microsoft Email Clients with Exchange Server," page 165.) This mail server is the smart host. To set up the smart host, start the Internet Service Manager (ISM). Right-click the Default SMTP Site to display the context menu, and select Properties to display the site properties. Select the Delivery tab, and enter the name or IP address of the smart host in the Smart host text box, as Screen 1, page 188, shows. Click Apply or OK to complete the change.

Notice the form of the smart host name in Screen 1. This entry is the valid Domain Name System (DNS) name for the smart host mail server. In this example, the SMTP Service is accessing a mail server across the Internet. If the mail server is on your network, you can enter the standard server name that you use in LAN applications such as Windows NT Explorer.

You can improve the SMTP Service's performance slightly by specifying the IP address for the smart host instead of its name. To use the IP address, enter the address for the smart host in square brackets to let IIS know that this value is an IP address. When you use the IP address, IIS skips parsing the address string to identify it.

After you configure the smart host, you can use the SMTP Service to create a mail application. To create a mail application, use the Collaboration Data Objects (CDOs) for NT Server in your ASP application. The ASP code in Listing 1, page 188, uses a CDO to send a mail message using the NewMail object.

In Listing 1, the objMail.Send statement passes the recipient's email address (ken@kenssite.com), the sender's email address (johnr@myco.com), the subject line (Interest), and a variable (sBody) that contains the body of the message to the SMTP Service. The NewMail object is the easiest resource to use when composing a new message because it takes only a few lines of code. You can also use the Session object to create a session and perform advanced actions.

Related Content:

ARTICLE TOOLS

Comments
    There are no comments to display. Be the first one!
You must log on before posting a comment.

Are you a new visitor? Register Here

advertisement

advertisement

Windows is a trademark of the Microsoft group of companies. Windows IT Pro is used by Penton Media Inc. under license from owner.