Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

send mail not working when used with attachment Expand / Collapse
Author
Message
Posted Saturday, September 15, 2012 4:30 PM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Friday, July 25, 2014 7:38 AM
Points: 40, Visits: 569
hi,

below is the script i have in SQL Server Agent.

SET ROWCOUNT 0
EXEC msdb..sp_send_dbmail
@profile_name = 'SQL Mail',
@recipients = '<me@email.com>',
@subject = 'subject',
@body = 'Please see attached report',
@file_attachments = 'D:\MSSQL10.MSSQLSERVER\MSSQL\Log\output_report_3.txt'
--@query = 'sp_helpdb userdb',
--@execute_query_database = 'MSDB',
--@query_result_separator = ',',
go

the job completes successfully but does not send an email. there are no errors generated.

when i comment out @file_attachments, and instead uncomment the @query parameters then i do receive an email

what am i missing with the @file_attachments parameter?

thank you
Post #1359854
Posted Monday, September 17, 2012 9:53 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Yesterday @ 3:05 PM
Points: 13, Visits: 201
The query looks good. I don't think there is any additional arguments to be passed for attachements. The only thing I would like to point out is SQL Server limits the size of attachment to 1 MB by default.
Post #1360299
Posted Tuesday, February 19, 2013 11:35 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Friday, July 25, 2014 7:38 AM
Points: 40, Visits: 569
The script above does indeed work -- the email just went to the junk folder
Post #1421791
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse