Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 How to send multiple email using Sp_send_dbMail?

Author  Topic 

rudba
Constraint Violating Yak Guru

415 Posts

Posted - 2009-01-29 : 12:55:30
I configer database mail.
How can i send email to,cc, bcc with multiple people?

exec msdb..Sp_send_dbmail
@profile_name = 'MyName',
@recipients = 'yourname@yourname.com',
@subject = 'test message',
@body = 'TEST',
@file_attachments='D:\test.doc'

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-01-29 : 12:58:04
just separate the email addresses by ; delimiter in to,cc & bcc
Go to Top of Page

rudba
Constraint Violating Yak Guru

415 Posts

Posted - 2009-01-29 : 13:02:07
Thanks for reply.
I tried this but it wont work:

@recipients = 'to;aa@aa.com;cc;bb@aa.com;bcc;cc@cc.com',
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-01-29 : 13:08:02
oh...for that you need this (i thought you're asking to include multiple receipients ineach


@recipients = 'aa@aa.com',
@copy_recipients ='bb@aa.com',
@blind_copy_recipients ='cc@cc.com',
Go to Top of Page

rudba
Constraint Violating Yak Guru

415 Posts

Posted - 2009-01-29 : 13:41:11
Thanks, visakh16
Go to Top of Page

rudba
Constraint Violating Yak Guru

415 Posts

Posted - 2009-02-02 : 14:54:48
how do i attach multiple files?

exec msdb..Sp_send_dbmail
@profile_name = 'MyName',
@recipients = 'aa@aa.com',
@copy_recipients ='bb@aa.com',
@blind_copy_recipients ='cc@cc.com',
@subject = 'test message',
@body = 'TEST',
@file_attachments='D:\test.doc'
Go to Top of Page

revdnrdy
Posting Yak Master

220 Posts

Posted - 2009-02-02 : 15:02:51
Same way as adding multiple recipients..

excerpt from books online (which by the way you could have looked up).
*Note the brackets always mean optional. In other words a file attachment is optional when sending email.

[ @file_attachments = ] 'attachment [ ; ...n ]' ]

Is a semicolon-delimited list of file names to attach to the e-mail message. Files in the list must be specified as absolute paths. The attachments list is of type nvarchar(max). By default, Database Mail limits file attachments to 1 MB per file

r&r
Go to Top of Page

rudba
Constraint Violating Yak Guru

415 Posts

Posted - 2009-02-02 : 15:21:33
Thanks revdnrdy. I got it.
Go to Top of Page

LOOKUP_BI
Constraint Violating Yak Guru

295 Posts

Posted - 2010-04-14 : 16:33:47
Hi I have a similar problem with multiple attachments in sp_send_dbmail

SET NOCOUNT ON
EXEC msdb.dbo.sp_send_dbmail
@recipients='xxxx.xxxx@xxxx.org,
@subject = @sub,
@body = @tableHTML,
@body_format = 'HTML',
@profile_name = 'Refresh',
@file_attachments =@2PATH;@1PATH;


I have tried all of the following and still no luck
[@file_attachments =@2PATH;@1PATH];

@[file_attachments] =@2PATH;@1PATH;

[@file_attachments] =[@2PATH;@1PATH];

I have forum in regards to this.Could you reply to me there
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=143002
Go to Top of Page
   

- Advertisement -