How to Configure DBMail in SQL Server - MS SQL Server DBA Tutorial

In this video you will learn how to configure DBMail in SQL Server using SQL Server Management studio as well as using T-SQL. It also explains how to configure Google smtp server as dbmail account in SQL Server using SQL Server management studio as well as T-SQL Script. It illustrates the smtp server configuration both for Exchange as well as google, what is the port google smtp server uses as well as port number of Microsoft Exchange Server. Step by step dbmail profile configuration as well as account setup. It also shows how to delete dbmail profile and account in sql server.

Script to Configure Database Mail in SQL Server by using Google Account

USE MASTER
 GO
 sp_configure 'show advanced options',1
GO

 RECONFIGURE WITH override
GO
 

sp_configure 'Database Mail XPs',1 
--go
--sp_configure 'SQL Mail XPs',0
 

GO 
RECONFIGURE 
GO


    
--CREATE Profile [Techbrothers]
    
EXECUTE msdb.dbo.sysmail_add_profile_sp
      
@profile_name = 'Techbrothers',
      
@description  = 'EmailNotification';
    
--CREATE Account [TechBrothers]
    
EXECUTE msdb.dbo.sysmail_add_account_sp
    
@account_name            = 'TechBrothers',
    
@email_address           = 'Techbrotherssqlage@gmail.com',
    
@display_name            = 'TechBrothers',
    
@replyto_address         = 'Techbrotherssqlage@gmail.com',
    
@description             = 'Email Notification',
    
@mailserver_name         = 'smtp.gmail.com',
    
@mailserver_type         = 'SMTP',
    
@port                    = '587',
    
@username                = 'Techbrotherssqlage',
    
@password                = 'GiveCorrectPassword', 
    
@use_default_credentials =  0 ,
    
@enable_ssl              =  1 ;
    
-- Associate Account [TechBrothers] to Profile [Techbrothers]
    
EXECUTE msdb.dbo.sysmail_add_profileaccount_sp
      
@profile_name = 'Techbrothers',
      
@account_name = 'TechBrothers',
      
@sequence_number = 1 ;
 
How to Configure DBMail in SQL Server

4 comments:

  1. I admire this article for the well-researched content and excellent wording. I got so involved in this material that I couldn’t stop reading. I am impressed with your work and skill. Thank you so much. If anyone looking for the Reliable SMTP Server provider, Mails2inbox is the best choice.

    ReplyDelete
  2. Excellent website you have here, so much cool information!.. buying instagram likes illegal

    ReplyDelete
  3. We provide one of the finest services in the field of SMTP to our trusted clients. The service we provide includes SMTP which is simple mail transfer protocol that sends out numerous mails in a go. Our protocol service is secure and highly safe for the users. We make distinction is the standard we maintain.- https://medium.com/@jamasmiths/understanding-smtp-server-provider-with-ip-rotation-and-its-impact-on-email-marketing-58eac60259a3

    #SMTP server with IP rotation
    #SMTP IP rotation

    ReplyDelete