Has anyone seen a .net email queue?
I want to be able to specify the SMTP server to send via, report problems and retry emails if necessary or requested.
Ideally I'd like something open source.
If you are using .NET on Windows you can use the IIS SMTP service. Use SmtpClient and set the delivery method to pickup directory. Under this mode the SmtpClient will write to the SMTP pickup folder (something like c:\inetpub\smtp_root\pickup) instead of trying to deliver the mail itself. That folder is the queue of messages, and SMTP service will handle delivery, retry, and NDR's, etc. Much better than trying to write it yourself.
Checkout System.Net.Mail, http://msdn.microsoft.com/en-us/library/dk1fb84h.aspx. In particular you want to look at MailMessage and SmtpClient.
EDIT
// Invokes the SendEmail method on another thread.
// Read MSDN on catching exception on completion and then wait a bit and send again.
Task.Factory.StartNew(() => SendEmail());
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With