We help IT Professionals succeed at work.

sql mail attach-network -file

This works perfect;

exec msdb.dbo.sp_send_dbmail @profile_name = 'SQLMal'
  , @recipients = 'itmanager@xyz.com'
  , @subject = 'Consistency Checks of DEV'
, @File_Attachments c:\ConsistencyChecks\ConsistencyJobOutput.txt'

But if I want to attach the file(like below) from remote location why does it not like, can anyone please let me know why it does not like remote location, I don’t want to create a network drive.

@File_Attachments =‘\\dev\c$\ConsistencyChecks\ConsistencyJobOutput.txt'
Comment
Watch Question

Top Expert 2011
Commented:
When you say, it doesn't like remote location, what do you mean?

The only thing that could possibly be an issue would be permission to the location of the file.
Commented:
send_dbmail is executing in security context of sql server - e.g. under windows account sql server service is running. In most part of the cases it's local system or local service account. Those accounts don't have access to network resources.

You can change sql server startup account to domain account with appropriate rights. You should consider security implications as well as password policies, etc.
Commented:
I've requested that this question be deleted for the following reason:

Permission issue, resolved myself.

Commented:
Both answers in the thread indicates that author had the problem with the permissions.

Commented:
Both answers in the thread indicates that author had the problem with the permissions.
Top Expert 2011

Commented:
I totally agree with dwkor. These poster get ideas from experts and come and say, "I resolved my own problem" when infact they did with experts help.

In case, it was a permission issue which was sugested for him.

Explore More ContentExplore courses, solutions, and other research materials related to this topic.