send email using background thread
I would like to create a background thread and send out real time email alerts to users. and this should happen in server
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Suraj SahooPosted Feb 26, 2015, 2:02 AM
I had a similar requirement in .NET application, for which I followed "Pick up Directory", it is a very nice procedure to follow. In this you create an email file, in ".eml" format and save in a folder. Then you need a server which will pick up from the directory folder or even IIS directory and push the mail using SMTP settings.
Please follow the below links, I am sure these will help:
http://www.singular.co.nz/2007/11/using-an-smtp-pickup-directory-delivery-method-for-asp-net-development/
http://www.codeproject.com/Articles/9169/System-Web-Mail-and-the-pickup-directory
If in case you want to make the execution faster and just send the emails in the back groud, then Parallel.Foreach will work out for you. This will work asynchronously and send email, using a background thread.
If you want to fire email based on time, then you need to create a scheduler/service that will be configured to the Task manager(Windows) and that will run the service at specified times.
Thanks.
Accept if helps anyway.