In this article I will explain with an example, how to resolve the following error while sending email in SQL Server.
SQL Server blocked access to procedure 'dbo.sp_send_dbmail' of component 'Database Mail XPs'
 
 

Unblocking the sp_send_dbmail Stored Procedure in SQL Server

The very first step is to unblock the Stored Procedure  sp_send_dbmail used for sending emails using SQL Server.
If the Stored Procedure is executed while it is blocked, you will get the following error.
SQL Server blocked access to procedure 'dbo.sp_send_dbmail' of component 'Database Mail XPs'
 
To unblock the Stored Procedure, simply copy, paste and execute the following SQL queries.
USE [master]
GO
 
SP_CONFIGURE 'show advanced options', 1
RECONFIGURE WITH OVERRIDE
GO
 
SP_CONFIGURE 'Database Mail XPs', 1
RECONFIGURE WITH OVERRIDE
GO
 
SP_CONFIGURE 'show advanced options', 0
RECONFIGURE WITH OVERRIDE
GO
 
Once executed, the following messages will appear which confirms, everything went OK and sp_send_dbmail Stored Procedure is now unblocked.
SQL Server blocked access to procedure 'dbo.sp_send_dbmail' of component 'Database Mail XPs'
 
 

Downloads