Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

xp_sendmail attachment problem

Status
Not open for further replies.

djj55

Programmer
Feb 6, 2006
1,761
US
Hello,
I ultimately I would like to mail an Excel file created by a DTS. Note that I would really like the user to access the file on a file server but the CIO developed the current way of emailing the file.

Currently this code gives me an error:
Code:
EXEC master.dbo.xp_sendmail 'djj@my.local', 
	@subject = 'NIGHTLY PROCESSES', 
	@message = 'Hello'[b], 
	@attachments= N'C:\Data\Daily Reports\my.txt'[/b]

[COLOR=red]Server: Msg 18025, Level 16, State 1, Line 0
xp_sendmail: failed with mail error 0x80004005[/color]

If I run without the bold code the email is sent.

Can .xls files be sent?

Also is there a size limit to attachments? (Note my test attachment is 1KB.)

Thank you,
djj
 
I'm not sure what line is in bold. I assume that it's the @attachments line.

I don't remember if xp_sendmail has a file size limit, but if it does it's fairly large. It might be a permissions issue for the files on the servers hard drive. Are you sure that the file exists on the SQL Servers C drive and not your workstations C drive?

Denny
MCSA (2003) / MCDBA (SQL 2000)
MCTS (SQL 2005 / Microsoft Windows SharePoint Services 3.0: Configuration / Microsoft Office SharePoint Server 2007: Configuration)
MCITP Database Administrator (SQL 2005) / Database Developer (SQL 2005)

--Anything is possible. All it takes is a little research. (Me)
[noevil]
 
Is the file on the server or your local machine?

Keep in mind that xp_sendmail will be looking on the SQL server for that file not your local box. So if that path is non-existence on the server you will get that error.


Well Done is better than well said
- Ben Franklin
 
Thanks, I forgot about the location. I was using local machine instead of server.

I will check my code when the server is back as it just died for unknown reasons.
djj
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top