Hi, I am using Windows Authentication to send email using spsenddbmail. Sending email works if I do not try to add a remote attachment. It also works if I try to send email with a local attachment (on the SQL Server machine). It works for remote attachments (as remoteserver sharename test.txt).if. I am connected to SQL Server as a sysadmin (Windows Authentication test logon in the sysadmin role). However, if I try sending email with a remote attachment as a non-administrative user, the attachment fails. The error message I receive is: Msg 22051, Level 16, State 1, Line 0 Failed to open attachment file ' remoteserver sharename test.txt'.
Access denied. The Windows Authentication test logon is in the DatabaseMailUserRole Database Role and has full control of the remote share. It would appear there is some SQL Server permission setting that I'm missing to allow any user to add remote attachments. Obviously I can't just give everyone sysadmin rights on the server in order to let them include attachments in e-mail. Can anyone shed some light on this?
Also, you could fire up SQL Server Profiler to check the user for sp_send_dbmail. I think it uses the current user account to send the mail, so I would also confirm your windows account has permissions to the file. Send Multiple Attachments With Send DBMail. Up vote 3 down vote favorite. According to the MSDN article on sp_send_dbmail: [ @file_attachments= ] 'file_attachments'. Connecting to an SQL server instance without using square brackets to avoid backslash. Use parameters in a Cte.
I am running SQL Server 2008 R2 (64-bit) on Windows 2008 R2 Server (64-bit). Also the Windows Authentication test login I am using has full control of the remote share. Dba0419 (8/17/2012) Hi, I am using Windows Authentication to send email using spsenddbmail. Sending email works if I do not try to add a remote attachment. It also works if I try to send email with a local attachment (on the SQL Server machine). It works for remote attachments (as remoteserver sharename test.txt).if.
I am connected to SQL Server as a sysadmin (Windows Authentication test logon in the sysadmin role). However, if I try sending email with a remote attachment as a non-administrative user, the attachment fails.
The error message I receive is: Msg 22051, Level 16, State 1, Line 0 Failed to open attachment file ' remoteserver sharename test.txt'. Access denied.
The Windows Authentication test logon is in the DatabaseMailUserRole Database Role and has full control of the remote share. It would appear there is some SQL Server permission setting that I'm missing to allow any user to add remote attachments. Obviously I can't just give everyone sysadmin rights on the server in order to let them include attachments in e-mail. Can anyone shed some light on this? I am running SQL Server 2008 R2 (64-bit) on Windows 2008 R2 Server (64-bit).
Also the Windows Authentication test login I am using has full control of the remote share. DV Shouldn't need to give everyone sysadmin rights. It looks like tey need appropriate permissions on to access the files on ' remoteserver sharename '. Lynn Pettis or and (My Mirror Blog). There is only 1 login being used (for testing this issue) and that login has full control of the network share and is in the DatabaseMailUserRole Database Role. Example: EXEC msdb.dbo.spsenddbmail @profilename = 'DatabaseGoogleMailProfile', @recipients = '[email protected]', @subject = 'TESTING2', @body = 'This is a new test message2.'
, @fileattachments = ' remoteserver sharename test.txt' go When I grant the 1 login that I am using for testing SA rights in SQL Server I can attach and send files from a remote share. Dba0419 (8/17/2012) There is only 1 login being used (for testing this issue) and that login has full control of the network share and is in the DatabaseMailUserRole Database Role. Example: EXEC msdb.dbo.spsenddbmail @profilename = 'DatabaseGoogleMailProfile', @recipients = '[email protected]', @subject = 'TESTING2', @body = 'This is a new test message2.'
, @fileattachments = ' remoteserver sharename test.txt' go When I grant the 1 login that I am using for testing SA rights in SQL Server I can attach and send files from a remote share. Whether the login is a sysadmin or not does not make all the difference in terms of the attachment.
Consider that a SQL Login is not restricted to only sending emails without attachments and that the SQL Login executing spsenddbmail does not have a Windows context to use. Confirm the non-sysadmin user has permissions to the Mail Profile you're using.
Edit: strike 'not', a key word to the meaning of post There are no special teachers of virtue, because virtue is taught by the whole community. As a side note, having your SQL Server run as a Domain Admin is quite dangerous considering you're about to open this up for users to send emails with attachments. Essentially this means anyone can send an email and attach any file on the network for which they know the UNC path to an email and send it to themselves. There are no special teachers of virtue, because virtue is taught by the whole community. You can't post new topics.
You can't post topic replies. You can't post new polls. You can't post replies to polls. You can't edit your own topics. You can't delete your own topics. You can't edit other topics.
You can't delete other topics. You can't edit your own posts. You can't edit other posts. You can't delete your own posts. You can't delete other posts.
You can't post events. You can't edit your own events. You can't edit other events. You can't delete your own events. You can't delete other events. You can't send private messages. You can't send emails.
You can read topics. You can't vote in polls. You can't upload attachments. You can download attachments.
You can't post HTML code. You can't edit HTML code. You can't post IFCode.
You can't post JavaScript. You can post emoticons. You can't post or upload images.