How to send an email from mssql when the email addresses are in the results of the query
I have a table that contains the order status and email address , If I do a select * statement this is my output Name. Email Adress Approval code Order states. Qty tickets. Juan Rivera. Juan @anyemail.com. Null. 1 50 Maria Rosales Maria @anyemail.com. 5567657. 1. 25 Jose Almonte.
Jose@anyemail.com. Null. 1. 10 What I would like to do is run a stored procedure everynight and send an email to every user that has a null in the approval code, for example : Dear : Jose , We noticed that your order does not contain an approval code , this order is scheduled to be canceled unless an approval code is entered in the next 72 hours. Thanks you Is this possible ?
HI You should be able to use the [sp_send_dbmail]. Build your email up on the fly. We have in the past built up HTML as it can be made to look better than plain text, especially when you require formatting. :