How to Configure Database Mail?

11
28319

Friends,

Lets discuss about the steps involved in configuring the Database  Mail in your database. PFB the steps involved.

  • First connect to SSMS (Sql Server Management Studio) and select Management folder in Object explorer.

  • Right click on “Database Mail” option and select “Configure Database Mail” option.

  • When the Welcome Wizard opens click NEXT.
  • Select the option “Select database mail by performing the following tasks” and click NEXT.

  • Provide Profile Name and Select ADD to add a new profile.

  • Here you need to provide all the SMTP settings as shown below.

  • Once the details are provided correctly then select OK and then you can see a new profile created. Check the same to set as default and click NEXT .

  • Continue clicking NEXT until you reach the last page and Click FINISH. You can see configuration status as shown below.

  • Now the configuration part is set. Now to configure EMail in DB, go to Query analyzer and execute the following code.

sp_CONFIGURE ‘show advanced’, 1
GO
RECONFIGURE
GO
sp_CONFIGURE ‘Database Mail XPs’, 1
GO
RECONFIGURE
GO

  • Once setup is done, we are ready to test our mails. PFB the code to be used to check the same.

USE msdb
GO
EXEC sp_send_dbmail @profile_name=’MailServer’,
@recipients=’something@gmail.com’,
@subject=’Test’,
@body=”This is to test Database Mail.

This is it. You can use the following queries to check the status of the mail sent.

SELECT * FROM sysmail_mailitems
SELECT * FROM sysmail_sentitems
SELECT * FROM sysmail_log

Hope this helps you .. Enjoy coding guys !!

Regards,
Roopesh Babu V

11 COMMENTS

  1. Don’t buy from sites that say their levitra reviews supplied by a trusted pharmacy at low pricesАвторский
    The diagnosis can be made using a 75-g glucose load, but that test is not as well validated for detection of at-risk infants or mothers as the 100-g OGTT.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

+ seventeen = 26