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
 Transact-SQL (2005)
 Send an email with file attachment

Author  Topic 

Aussie74
Starting Member

2 Posts

Posted - 2015-02-19 : 10:03:26
Hi all,

I'm trying to send an email with a file attached.

I have no problem doing this when the file is on the same server as SQL but I can't have it work when the file is stored on another server.

Is there a way to do this and if so how ?

Thanks in advance for your help

gbritton
Master Smack Fu Yak Hacker

2780 Posts

Posted - 2015-02-19 : 10:20:30
The main thing is this: the SQL user running the send mail operation needs to have access to the file on the other server. Usually this means that the sql user needs to be mapped to a sql login that is in turn mapped to a windows domain account with the required privileges.

If you are running interactively in SSMS, e.g. and your SQL login is mapped to your windows login, then it will work, assuming you have the correct privileges. If, OTOH, this is running from an Agent job, or being invoked another way, you need to be sure that SQL Server Agent (or whoever is actually running the send mail operation) has the needed privileges.
Go to Top of Page

Aussie74
Starting Member

2 Posts

Posted - 2015-02-20 : 05:20:30
OK, thanks a lot for the answer.
I'll have a look at this.
Go to Top of Page
   

- Advertisement -