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?
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