How to send email through sql server

This article demonstrates how to Configure Database  Email in SQL server step by step.

 

STEP 1:  Management – > Database Mail – > Configure Database  Email

click on Nexthow to send email through sql server

STEP 2

click on Next

how to send email through sql server

STEP 3

click on Add

how to send email through sql server

STEP 4

click on New Account

how to send email through sql server

STEP 5

Fill Mail Account Detail

Note: If smtp server  have SSL  then Check This server requires a secure connetion(SSL).

Password and confirm password not create any new account it just confirms your password.

click on OK

how to send email through sql server

STEP 6

click on Next

how to send email through sql server

STEP 7

click on Next

how to send email through sql server

STEP 8

click on Next

how to send email through sql server

STEP 9

click on Finish

how to send email through sql server

STEP 10

click on Close

how to send email through sql server

Congratulations! your email set up is finish. Now you can test.

how to send email through sql server

 

how to send email through sql server

SQL Script to send email

by help of  “sp_send_dbmail ”  you can send email through  SQL script

exec msdb.dbo.sp_send_dbmail
@profile_name = 'Sql Alerts',
@recipients = 'techalltype@gmail.com',
@subject = 'Mail Test',
@body = ' This is a test e-mail sent from Database Mail on <span style="color:red;">LEGEND-PC\LEGEND.</span>',
@body_format = 'HTML'

--  see your email sent or failed

select * from msdb.dbo.sysmail_mailitems

 

 

Tags: