Sql Server Database Mail attachments from FileTable msg 22051 (file is invalid) - by Reuven Trabin

Status : 


Sign in
to vote
ID 756716 Comments
Status Closed Workarounds
Type Bug Repros 2
Opened 8/2/2012 1:32:25 PM
Access Restriction Public


I'm transitioning email services in an web (mvc3) application from .Net to sql Database Mail. Some of the content we want to send as attachments has been uploaded to a sql FileTable. When I use the UNC path for the attachment (@file_attachments=), I get this error:

    Msg 22051, Level 16, State 1, Line 0 Attachment file
    is invalid.

I can open the file directly using the same path, and when I copy the file to a local folder, the file attaches fine. I suspect that the issue is folder permission for the FileTable directory. But I can't find any hooks to set the rights for that folder.

I'm running the EXECUTE msdb.dbo.sp_send_dbmail locally in SSMS (local sql instance) using windows authentication.
Sign in to post a comment.
Posted by Murali Natarajan1 on 10/15/2013 at 7:06 AM

My application and database are in different server, hence i created application folder as map drive in database server. But when i am trying to send mail using SQL mail service receiving below error.

request to suggest how to send attachments from map drive/ shared folders using SQL mail service.

Msg 22051, Level 16, State 1, Line 0
Attachment file \\\UploadFiles\This Week Task List OLD_15Oct2013183539.xlsx is invalid.

Appreciate the support

Posted by Ryan DC Metro on 4/10/2013 at 11:06 AM
It's rather unfortunate that this doesn't work as it is a great way to centralize sending emails with attachments from a database server (which was my entire plan).
Posted by Alex [MSFT] on 3/28/2013 at 12:10 PM

We took a look at this bug along with several others recently.
Unfortunately, triaging it against other critical bugs, I do not think we would get to investigating this in the near future. However, we have taken note of this internally, and when we revisit this functionality in the future, we will try and get this resolved.

Thanks for writing in to Microsoft.
Alex Grach[MSFT]
Posted by Sethu [MSFT] on 8/14/2012 at 10:23 AM
Thanks for reporting this issue. We shall investigate this issue and keep you posted wirth our findings

Sethu Srinivasan [MSFT]