Database Mail won't send attachments

  • Just in time for the release of 2008, we upgraded to 2005 last night. Other than some security issues, it did go fairly smooth.

    However, I am running into a problem and I am out of ideas on how to fix it. Granted lack of sleep is taking a toll.

    One of the problems that we had was that SQLMail no longer seemed to recognize the Outlook Mail Client running on the machine. I thought, no big deal, it can't be that hard to change over the 20 or so reports to use Database Mail instead.

    I enabled Database Mail, set up a profile, and successfully fired off the first couple reports.

    My problems turn up when I send off a report that includes an attachment. The e-mail shows up in my Inbox, but the attachment is not there.

    There are no error messages in the logs. It seems like it must be a security issue of some sort, but I am just out of ideas.

    Here is the call to Database Mail:

    exec msdb.dbo.sp_send_dbmail 'sqlmail' ,

    @recipients = 'me@mydomain.com',

    @subject = 'Daily Model 400 Outbox Message Count',

    @BODY = 'Outbox Message Count Report is attached.',

    @query_attachment_filename = 'c:\reports\39EEFD51-88B6-4A45-8630-440303DEB696.PDF'

    The report is there on the server, just not in the e-mail.

    Any help would be much appreciated!

    Scott

  • Try using @file_attachments = 'file_attachments' parameter instead.

    When you want the results from an @query parameter attached as a file you'd use @attach_query_result_as_file = 1 along with @query_attachment_filename.

  • That was the problem!

    Thanks for your help.

    Scott

Viewing 3 posts - 1 through 2 (of 2 total)

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