In a previous post, I wrote up how to send emails to a directory instead of an email server when using the SmtpClient class.  But, one thing I DIDN’T write about was how to send those files out AFTER sending them to the directory.
 
The first thing that has to be done is add the SMTP Virtual Server to IIS.  In the Add/Remove Windows Components dialog box, highlight ‘Application Servers’ and then press the ‘Details’ button.  In the dialog that pops up, highlight ‘Internet Information Services (IIS)’, and then click ‘Details’.  In the dialog box that pops up, scroll down a bit and find ‘SMTP Service’.  Make sure that is check, then click OK through all of the dialogs. 
 
Once the SMTP Service is installed, go to the IIS Control Panel, and find ‘Default SMTP Virtual Server’ under the IIS Machine’s name.  Right click on the ‘Default SMTP Virtual Server’ item and select ‘Properties’ from the pop up menu.  Go to the ‘Delivery’ tab and click on the ‘Advanced’ button.  Put the host name in the Smart Host, and click OK until the properties dialogs are gone.
 
Once this is configured, to send out the email files, just put them in the Pickup directory, which by default is C:inetpubmailrootPickup.  As long as the SMTP server is running, the emails will be sent out automatically.
 
That’s it!
 
UPDATE:  See what happens when you write something before testing?  The directory should be the Pickup directory not the Drop directory.  Thanks to Mario for helping me figure that out!
Advertisements

One thought on “How to send out .eml files written by System.Net.Mail

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s