Database Mail - File Attachment Access Denied

3.9k views Asked by At

We have a function that uses SP_Send_DBMail. A user that has the DatabaseMailUserRole can send messages, but as soon as he attaches a file from a network share he receives the following error:

MSG 22051, Level 16, State 1, Line 0 Failed to open Attachment file '\....'. Access Denied.

He has read / write permissions on the network share. The SQLAgent account has read / write on the network share.

The application can send attachments fine, but he can't while walking the code or from the server.

If I grant him SysAdmin (only for testing) he can send the attachment.

What am I missing here?

1

There are 1 answers

0
Nizamettin Özpolat On

I experienced the same problem and found a solution.

I gave delegation to sql server service account which is active directory account, then the problem disappeared. The application must be restarted after delegation permission configuration.

enter image description here