Configuring a web services infrastructure - simple mail transfer protocol
Configuring a web services infrastructure
Configure simple mail transfer protocol
Simple Mail Transfer Protocol (SMTP) is the protocol for sending email messages from server to server. With IIS 7.0, you can configure SMTP with each web application. You can also load IIS 6.0 to create an SMTP server.
To send email from an ASP.NET application using the System.Net.Mail API, you must configure SMTP email. The IIS SMTP service is a simple component for forwarding email messages to an SMTP server for delivery. Configuring email services tells the System.Net.Mail API to which SMTP server the email generated by your application should be delivered. You can also configure your application to deliver email to a file location on disk where it can be retrieved for delivery later.
To configure SMTP email for a web application, follow these steps:
- Open IIS Manager and navigate to the level on which you want to configure SMTP.
- In Features View, double-click SMTP E-mail.
- On the SMTP E-mail page, type the email 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 email messages immediately. This requires an operational SMTP server for which the user has credentials.
- Store E-mail in Pickup Directory: To store emails 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 email 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. In most cases, this becomes the default SMTP virtual server.
- Type in the details of your TCP port into the corresponding text box (labeled as Port). Being the default setting, Port 25 is the standard TCP port for SMTP. In case when a few virtual servers need to use the same TCP port, this can be achieved by setting them up to different IP addresses.
- Some SMTP servers may require authentication settings to be set. If this is the case, all you need to do is specify mode and credentials under the Authentication Settings tab.
- If Store E-mail in Pickup Directory is selected, type the batch email location in the Store Email in Pickup Directory text box.
- Click Apply in the Actions pane.
Configuring SMTP within IIS 6.0
When you enable SMTP by using IIS 6.0 and you send a message, the message is copied to the Pickup directory (c:\inetpub\mailroot\pickup). If a messages comes through the designated TCP port (the default TCP port is port 25), it is put in the Queue directory (c:\inetpub\mailroot\queue). If the recipients are local, the message is delivered.
If the recipients are not local, the message is processed for remote delivery. The SMTP service tries to connect to the receiving mail server. In cases when the server isn't ready and the message cannot be delivered, it will be kept in the queue for repeating delivery attempts. You can set up the intervals and maximum number of repeating delivery attempts. These intervals are the retry settings. After recipients are verified, the message is sent. The server confirms the transmission and delivery of the message, finalizing SMTP process. All messages for remote domains can be sent to a smart host, which can then send them to the recipients.