1

I am using the sp_send_dbmail stored procedure of SQL Server and often getting error message:

Mail not queued. Database Mail is stopped. Use sysmail_start_sp to start Database Mail.

After that I used EXECUTE dbo.sysmail_start_sp to start email service again in SQL Server.

What could possibly be causing this error? Does anyone has any idea, then please let me know.

4
  • Did you check the SQL Server log? Commented Jul 31, 2017 at 11:55
  • how can i do that ? can you please provide query to do that Commented Jul 31, 2017 at 11:56
  • Type in sql server log in your favorite search engine, click the first link. Commented Jul 31, 2017 at 11:57
  • @TT. is there any way to check weather the mail service is running or stopped in sql server ? Commented Jul 31, 2017 at 13:42

1 Answer 1

1

I think this will help you...found it from this URLhere After starting the service using sysmail_start_sp run the following script. This will solve the issue

SET NOCOUNT ON
Declare @ch uniqueidentifier;
Declare @message_type nvarchar(256);
Declare @message_body nvarchar(max);
Declare @ctr bigint;
Declare @ctr2 bigint;
While (1=1)
Begin
Receive @ch = conversation_handle, @message_type = message_type_name from ExternalMailQueue
set @ctr2 = @ctr2 + 1
set @ctr = (select count(*) from ExternalMailQueue)
if @ctr = 0 
break
end
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.