I have a web app for a client built in C# .Net 3.5. The web app does lots of things and there is one part where I send some data via an asychronous web request to do some processing on the database. This can take anywhere from 5 to 60 minutes.
I then created a SQL trigger that when the column in the database that uses the Database Mail to send mail (via msdb.dbo.sp_send_dbmail).
This works fine, but our client forbids us to send mail from the database server.
Anyone have an alternative to this?
You could create an Email table containing all of the fields you need for your emails. Add a record for each email you need to send given your processing.
Next, write a Windows service that pings that database for new email records at a regular interval. If found, generate your emails and send them from your application tier. Don’t forget to have a boolean or similar mechanism indicating that the email has been sent so that it doesn’t get picked up more than once.