May 16, 2017 at 6:35 pm
Hi All,
I have an issue with database mail
When I run this :
USE msdb
EXEC sp_send_dbmail
@profile_name='pivotal jobs',
@recipients='Sarah@abc.com',
@subject='Test Attachment',
@body='An attachment has been included in this email',
@file_attachments='C:\abc.txt'
The error comes up “ Attachment file C:\abc.txt is invalid
But if I remove the file_attachment , it works well ( I got theemail )
I checked the permission for (hostname\users ) , it was only forRead and Read&execute only so I changed it into Full control butunfortunately The error is still there
I would really appreciate for the feedback
Cheers
May 17, 2017 at 8:55 am
Try removing the (all) quotes around the file name and path in the @file_attachments and retry.
May 17, 2017 at 10:28 am
Is this file really in the root of C: ? If so it could be a permissions issue.
May 17, 2017 at 10:58 am
also, the attachment has to be accessible to the SERVER; so if the file is on the C: drive of your laptop, and the server is a different machine than your laptop,it will not be found.
if it is network accessible, a unc path like '\\CentralFileServer\Documents\Lowell\Attachments\mydocument.docx' is a better example.
Lowell
May 17, 2017 at 5:52 pm
Thanks for the reply all . I would check the permission issue
Cheers
May 17, 2017 at 6:07 pm
When you check the permissions, make sure you look for the account under which the SQL statement is running. That's the account that needs file system permissions.
May 17, 2017 at 6:13 pm
Ed Wagner - Wednesday, May 17, 2017 6:07 PMWhen you check the permissions, make sure you look for the account under which the SQL statement is running. That's the account that needs file system permissions.
I don't get what you mean mate . Do u mean if I run sql statement using my account so my account need file system permission ?
but again what is file system permission ?
May 17, 2017 at 6:37 pm
WhiteLotus - Wednesday, May 17, 2017 6:13 PMEd Wagner - Wednesday, May 17, 2017 6:07 PMWhen you check the permissions, make sure you look for the account under which the SQL statement is running. That's the account that needs file system permissions.I don't get what you mean mate . Do u mean if I run sql statement using my account so my account need file system permission ?
but again what is file system permission ?
You want to attach a file to an email you're sending from SQL Server. SQL Server runs on the server. The file you want to attach has to be visible to the server. The security context in which the SQL executes needs permission to access the file, wherever it is. This is done with file system permissions. On the server, go to the directory where the file is and make sure the account has the proper permissions on the Security tab of the Properties dialog.
If you're running it as yourself, you need permissions to the file system. If the SQL Agent is running the statement, the service account needs the permissions.
May 17, 2017 at 6:47 pm
Ed Wagner - Wednesday, May 17, 2017 6:37 PMWhiteLotus - Wednesday, May 17, 2017 6:13 PMEd Wagner - Wednesday, May 17, 2017 6:07 PMWhen you check the permissions, make sure you look for the account under which the SQL statement is running. That's the account that needs file system permissions.I don't get what you mean mate . Do u mean if I run sql statement using my account so my account need file system permission ?
but again what is file system permission ?You want to attach a file to an email you're sending from SQL Server. SQL Server runs on the server. The file you want to attach has to be visible to the server. The security context in which the SQL executes needs permission to access the file, wherever it is. This is done with file system permissions. On the server, go to the directory where the file is and make sure the account has the proper permissions on the Security tab of the Properties dialog.
If you're running it as yourself, you need permissions to the file system. If the SQL Agent is running the statement, the service account needs the permissions.
thanks . will try
Viewing 9 posts - 1 through 8 (of 8 total)
You must be logged in to reply to this topic. Login to reply