Configure SMTP E-mail (IIS 7)

Configure SMTP e-mail in IIS when you want to deliver e-mail messages from your site. Mail can be delivered immediately or it can be delivered to a file location on disk where it can be retrieved for delivery later. For example, a company can provide an e-mail link for sending feedback messages or for requesting information.

Note

The e-mail configuration settings are consumed by the classes in the System.Net.Mail namespace. ASP.NET applications must use this namespace in for the configuration settings to have any effect.

Note

The SMTP server is not installed by default. SMTP can be added through the Features Summary area of the Server Manager tool in Windows Server® 2008.

For information about the levels at which you can perform this procedure, and the modules, handlers, and permissions that are required to perform this procedure, see SMTP E-mail Feature Requirements (IIS 7).

On the SMTP E-mail page, type the e-mail address of the sender in the E-mail address text box.

On the SMTP E-mail page, select one of the following delivery methods:

Deliver e-mail to SMTP server: to deliver e-mail messages immediately. This requires an operational SMTP server for which the user has credentials.

Store e-mail in pickup directory: to store e-mails in a file location on disk for later delivery by an application such as an ASP.NET application, or by a user, such as an administrator.

If Deliver e-mail to SMTP server is selected, do the following:

Type the unique name of your SMTP server in the SMTP Server text box or select the Use localhost box to set the name to LocalHost. Setting the name to LocalHost means that ASP.NET will use an SMTP server on the local computer. Typically, this is the default SMTP virtual server.

Enter a TCP port in the Port text box. Port 25 is the SMTP standard TCP port and is the default setting. More than one virtual server can use the same TCP port if all servers are configured by using different IP addresses.

The variable from string is the e-mail address of the sender. The variable /deliveryMethod:network configures IIS to deliver e-mail messages immediately. The variable /network.port int sets the TCP port that is used by IIS to deliver e-mail messages. The variable /network.host string specifies the host used for SMTP transactions. The variable network.defaultCredentials:True|False enables or disables authentication using the default network credentials. If defaultCredentials is set to True, Kerberos or NTLM will be used if the server supports these protocols. The variables network.userName:string and network. password:string set a Basic authentication user name and password.

To configure SMTP e-mail to store e-mails in a file location on disk for later delivery by an application, such as an ASP.NET application, or by a user, such as an administrator, use the following syntax:

The variable from string is the e-mail address of the sender. The variable/deliveryMethod:PickupDirectoryFromIis|SpecifiedPickupDirectory configures IIS to store e-mails in a file location on disk for later delivery. The variable /SpecifiedPickupDirectory string sets the file location on disk in which to store the e-mail messages for later delivery.

Note

When you use Appcmd.exe to configure the <mailSettings> element at the global level in IIS 7, you must specify /commit:WEBROOT in the command so that configuration changes are made to the root Web.config file instead of ApplicationHost.config.