Configuring Email And Testing Using SQL Server

Here are the steps to send a Test mail or attachment file through Email in SQL Server.

Step 1: Click on Management in your SQL Server Object Explorer, the click on SQL Server Logs. After that click Configure Database Mail as in the following screenshot,

a51

Step 2: When you clicked on the Configure Database Mail wizard (Next), select the Configuration Task window will be displayed,

a52

Step 3: You have options to Manage or view or Create Task. For Configuration Mail you need to select the option Set Up Database Mail by performing the following task.

Then click on Next Tab and you will see the following New Profile Account Creation window,

a53


Fill Profile Name, Description in it and click on Add option to create or add a new existing profile, you can see options in New Account tab as New Database Mail Account. Here fill Account Name, Description, Email Id, Display name , Server Name & Port No(25 default),

Example of Default port

Default Ports Server Authentication Port
SMTP Server (Outgoing Messages) smtp.gmail.com SSL 465 or 587
SMTP Server (Outgoing Messages) smtp.mail.yahoo.com SSL 465
SMTP Server (Outgoing Messages) smtp-mail.outlook.com SSL 587

You can check SSL option for secure connection, and then fill SMTP Authentication. I selected Basic Authentication as my system login and then clicked on OK. After that press then New Accounts creation Finish tab.

a54

Step 4:

When you clicked on Finish tab a new window will be visible with Success Status. You can view report in message form by clicking on Report option or click on close tab to close the window.

a55

Click on Close and Configuration Steps are done.

Now we can Test it by Sending a Test Mail

Once the Configuration is completed we can send Test mail by our Profile that we created:
  1. To send a Test Mail click on the following options,



  2. When you clicked on Send Test E-Mail, the following window will open,

    a58

  3. Select the Mail Profile you made and Destination email id, subject with Body Message and click on Send Test E-Mail tab. You will see the following window for processing status and click OK,

    a8

  4. We can View the Email send Status in Log File Viewer by clicking on SQL Server Logs, then Database Mail, and then View Database Mail Logs as in the following screenshot:

    a59


Similar Articles