How to specify the path of an attachment stored on a different computer in the same network
1
vote
1
answer
4741
views
I'm trying to send an email through SQL Server. The sp_send_dbmail has a parameter to specify the path of a file to send as an attachment. It works perfectly when the file is in the same server where SQL Server is hosted. However, I need to send a file that is stored on another server or computer in the same network.
How can I specify the path for such file?
Edit: I see no errors in the server agent logs nor dbmail.
I ran this query:
Select * FROM sys.dm_server_services
and gave the account under the service_account
column full control of the file in the remote server.
This is how I'm calling the sp:
EXEC msdb.dbo.sp_send_dbmail
@profile_name = 'Profile',
@recipients = 'email@email.com',
@subject = 'Testing Attachments',
@file_attachments = '\\servername\c$\Temp\OutputReport.pdf'
Error: Msg 22051, Level 16, State 1, Line 0
Attachment file '\\\servername\c$\Temp\OutputReport.pdf' is invalid.
Asked by Willy
(11 rep)
Jun 20, 2018, 10:34 PM
Last activity: Jul 27, 2025, 07:00 AM
Last activity: Jul 27, 2025, 07:00 AM