'Steps to create a sql server agent job to send emails daily
I have a query to retrieve the email ids from my demo table. I have also configured database email on my sql server. But I am new to sql server agent jobs. I want to send reminders to people who havent filled there daily task report at a specific time daily. Could anyone help me with detailed steps to create a job?
Solution 1:[1]
In that case, I beleive you need to use a query in the last step of your job and send the email using the stored_proc sp_send_dbmail (http://msdn.microsoft.com/fr-ca/library/ms190307.aspx) Hope this help
Solution 2:[2]
So basically you'll fetch all email addresses, store it in a temp table, and then trigger a mail in a loop by calling msdb.dbo.sp_send_dbmail for each of the email addresses from your stored proc. The job created will trigger at a scheduled time and call your stored proc that will do all this tasks. But before you start sending emails from SQL Server, you need to enable and configure Database Mail: https://database.guide/how-to-send-emails-from-sql-server-t-sql/
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | iTekExpert |
| Solution 2 |
