October 5, 2010 at 2:46 am
This always works for me.
-- this configures the database mail on the server
exec sp_configure 'show advanced options', 1
reconfigure
exec sp_configure 'Database Mail XPs', 1
reconfigure
-- this sends mail
DECLARE @p_body as nvarchar(max), @p_subject as nvarchar(max)
DECLARE @p_recipients as nvarchar(max), @p_profile_name as nvarchar(max)
SET @p_profile_name = N'General Administration Profile' -- mail profile name
SET @p_recipients = N'recipient@testemail.com;multiple.recipients@dbmail.com'
SET @p_subject = N'This is a test mail using sp_send_dbmail'
SET @p_body = 'This is an HTML test email send using <b>sp_send_dbmail</b>.'
EXEC msdb.dbo.sp_send_dbmail
@profile_name = @p_profile_name,
@recipients = @p_recipients,
@body = @p_body,
@body_format = 'HTML',
@subject = @p_subject
A couple of things to check:
1) Is your mail profile set to Default ? If not set this to yes.
2) What authentication method are you using in your profile settings ? -- set this to anonymous to begin with.
I hope this helps.
November 19, 2013 at 6:48 am
Try restarting the SQL Agent service.
January 23, 2014 at 8:28 am
It is the solution to my sql agent not sending email issue.
Thanks Bala!
Viewing 3 posts - 16 through 17 (of 17 total)
You must be logged in to reply to this topic. Login to reply