We have 2 different ways to send test email. One using Management
option and 2nd using system procedure.
Method
1: Send email using Sql Server Management option
Kindly follow the below given steps to send test email with database
mail.
STEP 1:
Connect to Database engine. In object explore expand the Management option. Right click on Database Mail and select send
test E-mail option.
STEP 2: Send
test E-mail popup will be open. You can see the 4 options are available are
there:
Database
Mail Profile: Select the database mail profile from which
you want to send test email.
To: Enter
the email address on which want to send test email.
Subject: There
is already a default subject, if want to change you can.
Body: In
body option, also have default text. If you want to send any relevant message
can type in given text area.
STEP 3: Click
on Send Test E-Mail button. You will get a dialogue box with message for
confirmation test email is received or not.
Method 2:
Send email using Store procedure
We use the sp_send_dbmail system procedure to
send an email. As you can see below I have entered the database mail profile name, recipients email address, subject and message (body).
use msdb
EXEC sp_send_dbmail
@profile_name='aspmantra
email profile',
@recipients='saklanivijay87@gmail.com',
@subject='Test Email',
@body='Welcome to Sql world'
No comments:
Post a Comment