Installing and Configuring SMTP Support
The Simple Mail Transfer Protocol (SMTP) comes as part of the basic IIS 7 installation, so you don't need to do anything special to get it. The use of SMTP, in this case, is for administrative tasks, not for e-mail in general, as you might expect. Your application may require the use of SMTP to send confirmation or status information when you're away from the office, or at least out of touch with the server. The following sections describe the SMTP support in more detail.
Understanding the purpose of SMTP in IIS 7
IIS 7 provides an option to configure an SMTP e-mail address for use by your application. The configuration identifies the application, not the recipient. In other words, the configuration tells IIS 7 how to identify the application to you as the message sender. You must still provide recipient information, such as your e-mail address, just as you always do as part of your application. The purpose of identifying the application is to help you identify the sender.
Note: Creating identification for your applications doesn't necessarily guarantee the safety of the information you send. Someone can spoof your sender information, making it appear that their information is coming from your application, even though it isn't. However, having the information in place does add a little extra security because most outsiders won't take the time to research this information, so it's worth having. In addition, at least the administrator will know where a message is from, rather than see a blank sender entry in an e-mail. Because the sender information also helps the e-mail make it through firewalls and virus detectors, it does have a purpose, but you shouldn't rely on it heavily.
It's easy to configure an e-mail address for the Web server as a whole, individual Web sites, applications, or even folders. The level at which a user makes a request determines the e-mail address that IIS 7 chooses. When the user is in an application, IIS 7 chooses the e-mail address for that application when you've configured one. Otherwise, IIS 7 looks one level at a time until it finds an e-mail address to use. If it finds a Web site e-mail address, IIS 7 uses it for communication. However, if you don't have a Web site e-mail address configured, IIS 7 looks for a Web server e-mail address. Configuring an e-mail address for each level is important because individual level addresses help you know where an application made a request.
To display the e-mail information for any level, select the level you want to change in the Connections pane and double-click the SMTP E-mail icon in Features view. You see the SMTP E-mail pane.
IIS 7 provides two methods to send an e-mail: Use an SMTP server or store the e-mail locally. When you use the SMTP server, IIS sends the e-mail immediately. On the other hand, storing the e-mail locally lets an application pick it up later. You can use this second approach with a custom application to make it easier to perform custom processing on the data. In both cases, you begin the process by providing an e-mail address in the E-mail Address field.
Configuring an SMTP server
The upper half of the SMTP E-mail window, contains the SMTP server settings. The following steps describe how to configure this option:
- Select the Deliver E-mail to SMTP Server option.
- Type the URI for the SMTP server you want to use or check the Use Localhost option.
IIS automatically provides the URI for the SMTP server when you choose the Use Localhost option. - Provide a port number to use in the Port field.
IIS provides the default setting of 25 for you. Configure this option only when your SMTP server has a special setup. - Choose an authentication type in the Authentication Settings area.
When you choose Not Required, IIS doesn't send any authentication information. About the only time this setting works is when you use Localhost. The Windows option sends your Windows credentials to the SMTP server and normally works only with an SMTP server on your network. For all other servers, you must use the Specify Credentials option.- When you choose the Specify Credentials option, click Set.
You see the Set Credentials dialog box. - Type your name and password as needed. Click OK.
- When you choose the Specify Credentials option, click Set.
- ?Click Apply to make the settings active.
Configuring a pickup directory
You normally use a pickup directory for local distribution of e-mail with a custom application. It's possible that you can encounter other situations where this option is helpful, but most administrators won't ever use it. The following steps describe how to configure this option:
- Select the Store E-mail in Pickup Directory option.
- Type the location of the pickup directory.
Click Browse if you need to search for the pickup directory on your hard drive.
Note: Make sure that everyone who requires access to the e-mail can access the pickup directory. In addition, some administrators make the mistake of not giving IIS proper access to the pickup directory, which can prove fatal to your application. - Click Apply to make the settings active.