tags:

views:

150

answers:

3

Our e-commerce site requires the sending of email Currently, for some odd reason, the server that is being used to do this is the database server... which clearly isn't ideal (i've just taken over here)

My idea is this - to write a windows service that checks for new mails that need sending (these are all in a sql db) and then process the mails seperately... I want to use a seperate mail server, to keep this efficient..

Has anyone had any experience of this?

Would it be sensible to (for example) set up a lightweight debian (or other distro) machine, with exim on? Would i be able to use that as the host ip address when specifying my smtp server to send email? I'm going to be using C#....

+2  A: 

I've done this quite a bit, and sometimes I've used a windows server running the SMTP service, other times we've used a third party. In either case you set the host of the mail server in the configuration file and your application can pick it up and continue working.

A nice thing about using a third party service, is that you should have less concern about being black listed.

JoshBerke
A: 

We did something very similar. We used the IIS SMTP server and wrote code in C# to pump messages directly into its pickup directory using SmtpDeliveryMethod.PickupDirectoryFromIis. systemnetmail.com has some sample code that may help you.

One thing to be careful of is race conditions in the database, especially if you are sending messages with more than one thread (which we were doing). We implemented a queue in the database and used the UPDLOCK and READPAST hints in SQL Server for maximum performance. I think we got it up to over 10,000 emails a minute this way.

Daniel Pryden
A: 

You can use the Windows SMTP server wich you can access and use from your web or console application using the CDOSYS or CDO object. You can use this link about configuring the SMTP server on Windows 2003

backslash17