Queueing framework solution
I would like to address such a issue: I have a HTML form (like register form) which submission sends email. Now I send it as a part of page request. Obvious drawbacks:
- makes request longer
- sometimes smtp server is down, or timeouts and emails are not sent
When working with PHP I used a solution 开发者_运维知识库that based on queue - I had been putting an object/xml to queue host, and then some kind of client checked that queue. If queue task was sucessfully handled it removed task from queue. I wonder, is there a similar implementation on Windows / .NET platform ?
Thanks,Paweł
There is robust queuing offered by MSMQ which is easy to use in .NET. Accessing Message Queues might be a good place to start.
AH - why?
I have a HTML form (like register form) which submission sends email.
Have the submission write the email to a local drop directory, then use the SMTP service of the Windows system to submit them to your providers email server. Alternatively use your own service to copy them to the outgoing email pickup folder (I do that so I can put in a code pointing to the website for tracking).
These are provided standard methods.
You don't neccessarily need a queue as such. You can use the SendAsync method on the System.Net.Mail.SmtpClient class. That will return immediately and not block the page.
See: http://msdn.microsoft.com/en-us/library/x5x13z6h.aspx
精彩评论