ICT Role in 21st Century Education & its Challenges.pptx
How_Sending Mails via SQL-Server.pdf
1. 1
04 juillet 2017
Sending Mails via SQL-Server
SAPPL Mercedes-Benz
Société Algérienne pour la
Production de Poids Lourds de
Marque Mercedes-Benz SPA
Route Nationale N'5 Rouïba
Alger, Algérie
Author: ALAOUI Mohamed
Function: Ingénieur Systèmes d’information
Department : IT
Date : 04-07-2017
2. 2
04 juillet 2017
I. Introduction:................................................................................................................................ 3
II. Advantages.................................................................................................................................. 3
III. Configuration........................................................................................................................... 3
1- Configure the account and the profile : ................................................................................. 3
2- Send the email using the procedure msdb.dbo.sp_send_dbmail........................................... 4
IV. Logs Accounts and Profiles informations : .............................................................................. 4
3. 3
04 juillet 2017
Sending Mails via SQL-Server
I. Introduction:
This topic will describe the methods that will allow us to send notifications via mails, using
only SQL Server’s Stored procedures and Triggers, and without using any third-party
applications
II. Advantages
• Notifying DBAs and other users when SQL Server Agent jobs complete, fail, or
succeed
• Sending the results of queries via email to interested individuals
• Sending alerts when certain conditions arise on my SQL Server instances
• Save a lot of time
III. Configuration
1- Configure the account and the profile :
Account name
Profile name
Sender email address
name
4. 4
04 juillet 2017
2- Send the email using the procedure msdb.dbo.sp_send_dbmail
IV. Logs Accounts and Profiles informations :
• To troubleshoot the email sending we can consult the log using the table
msdb.dbo.sysmail_log
• To trace the different Accounts in the Database we can consult the table
msdb.dbo.sysmail_account
• To trace the different Profile in the Database we can consult the table msdb.dbo.
sysmail_profile
Email subject
Email recipients
Email Body