Using SQL Server 2012 SP1
I have a user that is submitting a procedure that uses sp_send_dbmail. I have also noticed that they have the following code in their procedure
DECLARE @rc INT
IF NOT EXISTS (SELECT * FROM msdb.sys.service_queues
WHERE name = N'ExternalMailQueue' AND is_receive_enabled = 1)
EXEC @rc = msdb.dbo.sysmail_start_sp
The user submits the procedure and she gets the email but she also gets the following error message:
Msg 15151, Level 16, State 1, Procedure sysmail_start_sp, Line 8
Cannot alter the queue 'ExternalMailQueue', because it does not exist or you do not have permission.
Mail (Id: 2402) queued.
(1 row(s) affected)
I have granted execute to sp_send_dbmail and sysmail_start_sp. I have also granted select to service_queues.
Does anyone have any solutions for the above error message?
lcerni