Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.Net SMTP Queue

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.

like image 909
Fran Hoey Avatar asked Jan 30 '12 21:01

Fran Hoey


2 Answers

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.

like image 198
Giscard Biamby Avatar answered Sep 28 '22 04:09

Giscard Biamby


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()); 
like image 41
Richard Schneider Avatar answered Sep 28 '22 04:09

Richard Schneider