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

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 How to send multiple email using Sp_send_dbMail?
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

rudba
Constraint Violating Yak Guru

415 Posts

Posted - 01/29/2009 :  12:55:30  Show Profile  Reply with Quote
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

India
52326 Posts

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

rudba
Constraint Violating Yak Guru

415 Posts

Posted - 01/29/2009 :  13:02:07  Show Profile  Reply with Quote
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

India
52326 Posts

Posted - 01/29/2009 :  13:08:02  Show Profile  Reply with Quote
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 - 01/29/2009 :  13:41:11  Show Profile  Reply with Quote
Thanks, visakh16
Go to Top of Page

rudba
Constraint Violating Yak Guru

415 Posts

Posted - 02/02/2009 :  14:54:48  Show Profile  Reply with Quote
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

USA
220 Posts

Posted - 02/02/2009 :  15:02:51  Show Profile  Reply with Quote
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

Edited by - revdnrdy on 02/02/2009 15:05:52
Go to Top of Page

rudba
Constraint Violating Yak Guru

415 Posts

Posted - 02/02/2009 :  15:21:33  Show Profile  Reply with Quote
Thanks revdnrdy. I got it.
Go to Top of Page

LOOKUP_BI
Constraint Violating Yak Guru

295 Posts

Posted - 04/14/2010 :  16:33:47  Show Profile  Reply with Quote
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

Edited by - LOOKUP_BI on 04/14/2010 16:34:26
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.04 seconds. Powered By: Snitz Forums 2000