Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 Database mail security w/file attachments

Author  Topic 

Sully
Starting Member

30 Posts

Posted - 2008-08-08 : 10:27:56
Hi All,

My problem relates to sp_send_mail and file attachments in SQL 2005. I have a sql server authenticated account which at times needs to send out email with attachments. The attachments are stored on a remote server. This works fine if I set the account up with Server Role sysadmin. I would prefer, for obvious reasons, not to use that kind of security clearance for this account. Nothing else I have tried has worked. I've read that SQL uses windows security for accessing the files remotely, which is why it doesn't work otherwise. Aside from storing the email file attachments locally, which is a different problem altogether, is there anything else I can try, to get around this problem.


Stuck in neutral in a pedal to the metal world,
Sully

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2008-08-09 : 00:43:01
Then you need create sql agent proxy account for that.
Go to Top of Page

Sully
Starting Member

30 Posts

Posted - 2008-08-11 : 10:52:52
Thanks for the reply rmiao, I will research that.

Stuck in neutral in a pedal to the metal world,
Sully
Go to Top of Page

Sully
Starting Member

30 Posts

Posted - 2008-08-13 : 13:21:29
Hi All,

I have a solution for this for those who might be interested. Of course if anyone has any concerns about how I went about this I would welcome your comments. I have placed an SP in the MSDB database with an execute as clause. This SP only executes the sp_send_dbmail system sp with the appropriate parameters. The user I set the execute as does have sysadm rights, however the user sending the email does not. When I check the mailitems table in MSDB, the send_request_user column now shows the execute as user. All my tests have been successful so far.

Stuck in neutral in a pedal to the metal world,
Sully
Go to Top of Page

rdelar01
Starting Member

1 Post

Posted - 2009-08-05 : 09:37:00
Hi Sully
I saw you post regarding your implementation. Can you please provide me how you implemented your work around?
Thanks,

Ryan
quote:
Originally posted by Sully

Hi All,

I have a solution for this for those who might be interested. Of course if anyone has any concerns about how I went about this I would welcome your comments. I have placed an SP in the MSDB database with an execute as clause. This SP only executes the sp_send_dbmail system sp with the appropriate parameters. The user I set the execute as does have sysadm rights, however the user sending the email does not. When I check the mailitems table in MSDB, the send_request_user column now shows the execute as user. All my tests have been successful so far.

Stuck in neutral in a pedal to the metal world,
Sully

Go to Top of Page
   

- Advertisement -