I am trying to send pdf attachments in sql email (sql server 2008). Sometimes the attachment is present in the emails , but its corrupt and cannot be opened. Sometime email itself is not going. When I try the same without adding the attachment, emails goes everytime. The attached file is hardly 300 KB and is present in teh server always.
Below is the code which ia m using to send emails.
EXEC msdb.dbo.sp_send_dbmail
@profile_name = @Profile,
@recipients = @EmailTo,
@copy_recipients = '',
@subject = @EmailSubject,
@body = @EmailBody,
@file_attachments = @Attachment,-- this will contain the physical file of teh document in database server.
@body_format = 'HTML',
@execute_query_database = 'DBNAME'
I am not able to zero in as to what the issue is.