May 8, 2009 at 10:33 am
Hi,
I configured the database mail and its working fine if I add only one recepient. But Its sending NO email if I add two recepients separated by semicolon(;)
and I also I tried by adding 2 recepients separated by ; in Operator. please see the attachments and advice how can I send email to multople recepiets.
Thanks
May 9, 2009 at 11:39 pm
hi,
In database mail,Sending email to multiple recipients is possible or not? If yes please tell me how to achieve that.
thanks
May 10, 2009 at 5:15 am
not on the screens you were setting up; that set up the profile, where it is only one account.
if you want replys to any email to go to multiple persons, you need to set up a group on your email server, so stuff like 'sales @yourdomain.com' gets resent by your server to other, multiple emails.
replyto: expects a single email;
To:,CC: and BCC: are the onyl fields that expect multiple email addresses.
Lowell
May 14, 2009 at 11:05 am
thanks Lowell,
Iam able to create a group abc@xyz.com(which consists all the DBA's email addresses) and database mail sending email when the job succeeded. But I want an email to send an operator(ops@xyz), when the job fails.
So Iam not able to get these 2 done together i.e
Send an email to abc@xyz.com when job succeeds and send an email to ops@xyz when job fails?
how to acheive the above? is there any way to give To: Cc: in the dbmail configuration?
May 14, 2009 at 11:20 am
thanks Lowell,
Iam able to create a group abc@xyz.com(which consists all the DBA's email addresses) and database mail sending email when the job succeeded. But I want an email to send an operator(ops@xyz), when the job fails.
So Iam not able to get these 2 done together i.e
Send an email to abc@xyz.com when job succeeds and send an email to ops@xyz when job fails?
how to acheive the above? is there any way to give To: Cc: in the dbmail configuration?
May 15, 2009 at 5:53 am
you'll need to handle errors a s a separate email, something like this:
DECLARE @Results int
EXEC @Results = msdb.dbo.sp_send_dbmail
@profile_name = 'AdventureWorks Administrator',
@recipients = 'danw@Adventure-Works.com',
@body='Whatever the body was'
...
if @Results 0 --error returned froms erver is error number, ie 550 no relaying, etc.
BEGIN
EXEC @Results = msdb.dbo.sp_send_dbmail
@profile_name = 'AdventureWorks Administrator',
@recipients = operators@yourdomain.com,
@subject='Failure to send email.'
...--include everyone who didn't get the mail, the original body, etc for reference
END
if @Results 0 --cant send to the operators? server or network issue?
BEGIN
--log to the database, because the email server is down.
END
END
Lowell
May 15, 2009 at 5:56 am
can u please tell me how u set up mail alert using database mail
May 15, 2009 at 6:44 am
I dont know what mechanism you are using to send email, but I create 2 steps at the end of every job I run, 1 is for success, the other is for failure. And in both of them I put the corresponding messages for them, and send them out with something similar to this:
EXEC msdb.dbo.sp_send_dbmail
@recipients='RKelly@dom.com;BElliott@dom.com',
@profile_name = 'SQL_Notifier',
@subject = 'ExTraLoader - SRD Import Success',
@body = @table ,
@body_format = 'HTML';
This ALWAYS works no problems at all.
HTH - RJK
July 11, 2023 at 7:27 am
This was removed by the editor as SPAM
Viewing 9 posts - 1 through 8 (of 8 total)
You must be logged in to reply to this topic. Login to reply