Click here to Skip to main content
15,890,690 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear sir,

I have configure the Data base mail as learnt from you.
now i need one help.

kindly provide me steps for the below query

1.I have to send mails to different recipients by taking the recipients email address from a table
2. how to create a job where in system has to exec a query based on the condition it has to fetch the email address from a table and sent a mail.

kindly help
Posted

1 solution

I probably would:
- Create a procedure which has a cursor to fetch the desired rows
- loop through the cursor and use sp_send_dbmail to send an email
- schedule execution of the procedure using SQL Agent.

Have a look at
- CREATE PROCEDURE[^]
- DECLARE CURSOR[^]
- sp_send_dbmail[^]
- Create a job[^]
 
Share this answer
 
v3

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