Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Database Mail Error

Posted on 2013-11-06
3
Medium Priority
?
1,383 Views
Last Modified: 2013-11-12
I am able to send the email from database mail without the attachment.
When I add the attachment I receive this error.
Error: Msg 22051, Level 16, State 1, Line 0
Attachment file \\JMID\Testing2\MyNewTest.txt is invalid.
I checked to make sure the service account has permissions to the folder and that I have permissions to the folder and file.  
and the text file. I tried mapping the drive. I used the local path and the shared folder
path. Not sure why this will not work. We are using outlook here. Any suggestions would be appreciated.

 Thanks In Advance


EXEC msdb.dbo.sp_send_dbmail
@recipients= N'myemailaddress@example.com',
@profile_name =N'MyProfileName',
@subject =N'Testing mail ',
@body= 'Please see attachment for details',
@file_attachments= N'\\JMID\Testing2\MyNewTest.txt'

Error: Msg 22051, Level 16, State 1, Line 0
Attachment file \\JMID\Testing2\MyNewTest.txt is invalid.
0
Comment
Question by:VitaminD
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 35

Expert Comment

by:David Todd
ID: 39629490
Hi,

What account is SQL running under? Does this account have rights to this share & file?

Regards
  David
0
 
LVL 13

Expert Comment

by:jonnidip
ID: 39629730
As suggested before, it really seems to be a permission issue on SQL Server service user.
You can just check with a local file (local I mean on the SQL server machine).

Regards.
0
 
LVL 20

Accepted Solution

by:
Marten Rune earned 2000 total points
ID: 39632729
You can put a audit on the server sharing the file, to see whats touching it.
if file audit is unknown to you, look at:
http://social.technet.microsoft.com/Forums/windowsserver/en-US/16c3050b-c6fb-42f0-b68b-25d4561ae9de/how-do-i-audit-access-to-a-folder

This will show you whats happening. And also, check the firewall log on the target server.
http://technet.microsoft.com/en-us/library/cc758040(v=ws.10).aspx

Regards Marten
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
An alternative to the "For XML" way of pivoting and concatenating result sets into strings, and an easy introduction to "common table expressions" (CTEs). Being someone who is always looking for alternatives to "work your data", I came across this …
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question