IIS SMTP folder structure and how smtp works
The message store of the SMTP service is created when you install the service on IIS. SMTP utilizes this directory structure to process mail. The folders created in the \Inetpub\Mailroot directory structure (message store) are listed below:
- Pickup: The SMTP service processes messages from the Pickup folder as outbound messages or as messages for delivery. If the message is intended for users that are members of the local domain managed by the SMTP service, the SMTP service moves the message to the Drop folder.
- Drop: Incoming messages intended for the local domains are placed in the Drop folder. This is true for all recipients because the SMTP service does not maintain a mailbox for each recipient.
- Queue: Messages that cannot be immediately delivered are moved by the SMTP service to the Queue folder from the Pickup folder. The SMTP service repeatedly attempts to deliver messages stored in the Queue folder.
- Badmail: The Badmail folder stores messages that could not be forwarded to the recipient, even after attempts have been made for a predefined number of times. Another characteristic of messages in the Badmail folder is that the messages cannot be returned to the senders of these messages by SMTP. This means that administrators have to handle messages residing in the Badmail message store.
- Mailbox, Route, SortTemp: Because these folders are not utilized in IIS 6, you can delete them from the SMTP directory structure.
The events that occur when SMTP processes mail are listed below:
- The SMTP service, smtpsvc.dll, runs in-process in the Inetinfo.exe IIS process.
- Smtpsvc.dll monitors TCP port 25 for any incoming messages.
- It monitors the Pickup folder for all outgoing messages.
- SMTP places messages for users that are members of the local domain it manages in the Drop folder for delivery.
- If a message has to be sent to a user that is a member of a different or remote domain, an ASP application has to create and place the outgoing message in the Pickup folder. This is done through the ASP application using CDOSYS.
- The SMTP service then performs a DNS lookup on the name server so that it can find the SMTP host that manages the remote domain. The port used for this process is port 53. The SMTP service checks for the MX record for the remote domain.
- After the fully qualified domain name (FQDN) of the remote SMTP host is determined, the SMTP service attempts to create a connection with the remote SMTP host to transfer the message for the recipient to it. Port 25 is utilized for the message transfer.
- If a connection cannot be established with the remote SMTP host, the SMTP service places the message in the Queue folder.
- If a connection can be established with the remote SMTP host but the connection is rejected by the remote SMTP host, the SMTP service forwards the sender of the message a non-delivery report (NDR), and returns the message as well. The message is placed in the Badmail folder if it cannot be returned to the sender.
- If a connection can be established with the remote SMTP host and the remote SMTP host accepts the connection, the SMTP service transfers the message to the remote SMTP host.
- After the message is received by the remote SMTP host it is sent to the POP3 or IMAP mail server which contains the mailbox of the intended recipient.
- The message is downloaded when the client connects to the POP3 or IMAP mail server.