sp_send_mail with multiple attachment

  • Im unable to send multiple attachment using 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 only get the attachment of @2PATH file in my email.

    I have tried as suggested to include 'SET NOCOUNT ON'.No luck

    If I were to try one variable at a time.It works fine

    How do I do this ?

  • This thread might help you out :

    http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=118851

  • I have tried the following, but no luck

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

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

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

    Anything Im missing

  • Have you tried with a single variable? I think I remember reading about that requirement on the post I sent you.

    SET @Path = 'c:\whatever.txt;d:\report.html;\\Shared\this.zip'

  • Still getting 1 attachment

    SET @s-2 = '\\xx.xx.xx.xx/d$/DailyErrorLog/DailyErrorLog.txt;\\xx.xx.xx.xx/d$/DailyErrorLog/DailyErrorLog.txt'

    @file_attachments= @s-2

  • Hope it's not a stupid question but have you tried with 2 different files or did you change your code for the post?

    Other than that I just don't know what else is the problem.

    I may suggest zipping them up and sending the zipped file but that seems like a bit of a wasted step for nothing.

  • Thank You Ninja, I had tried as per your suggestion.I have opted to do it in another way.Adding it as a hyperlink to an ssrs report that has the data

    Thank You for your time

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply