We’ve been using XP_SendMail with no issues just recently.
There is a stored procedure which produces a table and attaches the table to an email. This has been working perfectly for the last year or so but this month the file apparently has gotten too bigand produces the following error:
Server: Msg 18025, Level 16, State 1, Line 0
xp_sendmail: failed with mail error 0x80004005
The attached file is approximately 10 MB. I can change the QRY to limit the number of records to less than 22,000 and it works fine. I’ve also looked at the data to make sure there is no ‘unusual’ stuff hanging around.
We are using: Miscrosoft SQL Server 2000 ver 8.00.2039
So my question is: Is there an attachment size limit on XP_SendMail?
The sysadmin has reviewed Exchange and there is no size limit on this account.
This is the procedure:
DECLARE @strQuery varchar(2000), @strMessage varchar(200)
set @strQuery = '
SET CONCAT_NULL_YIELDS_NULL OFF
select DB1. accountno, DB2.contact, db2.lastName,
DB3.email, DB1.key1 as status
INNER JOIN DB2
on DB1.accountno = DB2.accountno
INNER JOIN DB3
on DB1.accountno = DB3.accountno
WHERE substring(DB1.key1,2,1) in (2,3,4,5,6)
and (DB3.contact = ''E-Mail Address''
and substring(DB3.zip,2,1) = ''1'' )
SET CONCAT_NULL_YIELDS_NULL ON
EXEC master..xp_sendmail @recipients = 'email@example.com',
@query = @strQuery,
@subject = 'Enter subject here',
@message = 'Enter message here',
@attach_results = 'TRUE', @width = 250