What are you looking for ?
Home » » Send Email From SQL Database

Send Email From SQL Database


SQL SERVER 2014 Configure Database Mail 

Database Mail is an enterprise solution for sending e-mail messages from the SQL Server Database Engine. Using Database Mail, your database applications can send e-mail messages to users. The messages can contain query results, and can also include files from any resource on your network.

Step (1)

  • In Object Explorer panel, connect to the SQL Server instance you want to configure Database Mail on, and expand the server tree.
  • Expand the “Management” node
  • Double click “Database Mail” to open the Database Mail Configuration Wizard.
  • Or right click under “Database Mail” and select the option “Configure Database Mail”

Step (2)

  • On the Welcome to Database Mail Configuration Wizard page, click “Next” to continue
  • On the Select Configuration Task page, select “Set up Database Mail by performing the following tasks:” and click “Next” to continue.
  • Set up Database Mail by performing the following tasks: Perform all of the tasks required to set up Database Mail for the first time. This option includes all of the other three options.
  • Manage Database Mail accounts and profiles: Create new Database Mail accounts and profiles or to view, change, or delete existing Database Mail accounts and profiles.
  • Manage profile security: Configure which users have access to Database Mail profiles.
  • View or change system parameters: Configure Database Mail system parameters such as the maximum file size for attachments.

Step (3)

  • If Database Mail has not been enabled, you will receive the message: “The Database Mail feature is not available. Would you like to enable this feature?” Click “Yes” to continue
  • On the New Profile page, specify the “Profile name” and “Description” to be included in the profile, and click “Add…” to specify an account

Step (4)

  • On the New Database Mail Account page, specify the account name, description, mail server information, and authentication type. Click “OK” 
  • A Database Mail account contains the information that SQL Server uses to send e-mail messages to an SMTP server. Each account contains information for one e-mail server and doesn’t correspond to a SQL Server account or a Microsoft Windows account. Database Mail can be sent using the credentials of the SQL Server Database Engine, using other credentials that you supply, or anonymously. When using basic authentication, the user name and password in a Database Mail account are only used for authentication with the e-mail server. An account need not correspond to a SQL Server user or a user on the computer running SQL Server.
  • E-mail address: yourmail@gmail.com
  • Display name: Your Name
  • Reply email: yourmail@gmail.com
  • Server name: smtp.gmail.com
  • Port number: 587
  • SSL: Checked
  • Basic authentication: Checked
  • User name: yourmail@gmail.com
  • Password: your password
  • Confirm password: your password

Step (5)

Consider public and privet profile security, Default Profile and email flow according to your environment and alert requirements. Flowing are the screens for the completion and over view of your Database mail configuration which you have carried out.

If you are using Gmail then:

The next step is to configure Gmail to allow access. Login to your Gmail account and select the “Security” page. Make sure the “Access for less secure apps” is Enabled:

Step (6)

The Database Mail should now be configured successfully and all should be correctly setup to send emails, but we must make sure by testing it. So we will send a test email and confirm the reception. To do that:
  • Right-click on Database Mail and select “Send Test E-Mail…”
  • On the Send Test E-mail from windows, specify a “To:” email and click “Send Test E-Mail”

Share this article :

Post a Comment

Flag Counter

Social Profile

Copyright x 2011. By Wael Medhat - All Rights Reserved