Click here to Skip to main content
15,884,176 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How can we email on email id using trigger by matching to time means how can we set-up email on time with any action like (insert , delete , update).email will be sent on email id in the evening of full working of the day.
Posted

1 solution

Look at what's already there, out-of the box? sp_send_dbmail does pretty much the same. It puts the mail request in a queue and uses an external application to do the SMTP stuff.

Suggestion: Triggers should be kept to a minimum time, do not listen to advice that recommends sending the email directly from trigger (eg. using SQLCLR). Beside the obvious performance hit (every DML operation on the table now has to wait for the huge latency of a SMTP or HTTP operation) you have the much bigger problem of transactional consistency, how do you recall the email on rollback?
 
Share this answer
 
Comments
Member 10434230 16-Jan-14 4:28am    
Was this helpful to you?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900