Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to receive SMTP mail and pipe it to a program. Can the IIS SMTP server deliver mail to a script or program?

I've looked on 2008 R2, but don't see an option for this.

EDIT: This is for a company which processes orders via email. I need to pipe those emails to a script which processes the order. I can think of a few ways to accomplish this in the UNIX world, but would prefer a Windows solution for this project.

share|improve this question

The IIS SMTP server is designed to either relay mail to another remote SMTP server or deliver it to a drop folder for local addresses. This means that to deliver an email to a script the script would either have to accept SMTP connections directly, retrieve the email from another server using POP (not the IIS SMTP server though, as it does not implement POP), or most likely poll the local drop folder for new messages and process them. You can configure the local drop folder for a virtual IIS SMTP server here and configure a script to monitor the directory for new files. Since the IIS SMTP server is only a virtual server you don't really have any other options. Exchange server is Microsoft's full SMTP/POP/Messaging server, which may be able to provide more email processing features.

Alternatively you could look into a different SMTP server such as the free XMail server that can be used to run external commands using custom domain processing or message filters. This however requires installing and maintaining a non-Microsoft SMTP server and using that instead of IIS SMTP.

share|improve this answer

You might need to write a script that will poll using POP or IMAP the server, and pull messages to deliver to the program you're looking for.

Otherwise you'll need to see if you can get a plugin for IIS that will redirect mail or set up a mail proxy that will analyze mail as it goes through and direct mail either to the program you want or to the end user it's intended for.

Are you looking for something to analyze all mail like an antivirus scanner or are you looking for particular messages that are formatted and directed at something like automating another application, so you need to pluck "command mails" out of the mailbox?

You might be able to just redirect mails for a particular address to a specific mailbox if that's the case...

share|improve this answer
Thanks for your thoughts. I'm using a script that acts as a POP client right now, and it works but is slow. The idea is that orders are placed via email, and I need to extract out the order information and process it. Piping all mail to a ProcessOrder script accomplishes this. – Bob Mar 13 '10 at 18:49
Where do the emails come from, a generated script from a website? Or from users themselves? One possibility is to just send all emails from a site to a special mail server that is actually a fake mail server. You'd have to harden it against exploits, but if all the emails come from a specific site/IP in a specific format, that should make it easier. – Bart Silverstrim Mar 13 '10 at 19:30
Orders come the users themselves. I'm not sure I follow your proposal? – Bob Mar 13 '10 at 19:49
@Bob: idea was that if the orders come in through a standard format, such as through an emailed form from a web page, you can create a program that listens on port 25 like a standard mail server, only it only accepts those emails formatted specifically for your order forms, then processes or hands them off to a program that processes the order. It looks like an SMTP server but only accepts the "magic" format of email from a specific source and rejects everything else. Then you don't need to shoehorn IIS or another SMTP server to work that way. – Bart Silverstrim Mar 14 '10 at 0:06

How do you propose it should "deliver mail to a program"? A SMTP server sends or accepts mail between servers and from clients. Accepted mail is stored on the server. If you know where its stored you can then process the received mail.

share|improve this answer
All UNIX-based MTA/MDA solutions I'm aware of will deliver mail to a file, or will pipe it to another application. I'm hoping the same capability exists in the Windows world. – Bob Mar 13 '10 at 18:59

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.