Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 can't email a url in my stored procedure

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-06-29 : 08:06:46
Tammy writes "Windows 2000 Service Pack 4
SQL Server Standard Edition Version 8

i've attached the stored procedure
and an example of its use

my problem is that the resulting email only contains a portion of whatever URL i put in the email....sometimes only the http: shows up sometimes http://www.abc.ca/fo

why doesn't the url show up in the body of the email???

thanks
tammy

exec sp_SendMailAttachments 'me@abc.ca','me@abc.ca','Request for Data','Please find instructions and information regarding the completion and submission of your data. Use the following link to access the online forms: http://www.abc.ca/forms',
'c:\temp\instructions.txt',
'c:\temp\information.txt'


CREATE procedure sp_SendMailAttachments
@To varchar(255),
@From varchar(255),
@Subject varchar(255),
@Body varchar(255),
@Attach1 varchar(255),
@Attach2 varchar(255)

AS


DECLARE @Mail int
DECLARE @hr int
DECLARE @src varchar(255), @desc varchar(255)


EXEC @hr = sp_OACreate 'Persits.MailSender', @Mail OUT


IF @hr <> 0
BEGIN
EXEC sp_OAGetErrorInfo @Mail, @src OUT, @desc OUT
SELECT hr=convert(varbinary(4),@hr), Source=@src,
Description=@desc
RETURN
END


EXEC @hr = sp_OASetProperty @Mail, 'Host', '130.15.52.20'
EXEC @hr = sp_OASetProperty @Mail, 'From', @From

EXEC @hr = sp_OASetProperty @Mail, 'Subject', @Subject
EXEC @hr = sp_OASetProperty @Mail, 'Body', @Body


EXEC @hr = sp_OAMethod @Mail, 'AddAddress', NULL, @To
EXEC @hr = sp_OAMethod @Mail, 'AddAttachment', NULL, @Attach1
EXEC @hr = sp_OAMethod @Mail, 'AddAttachment', NULL, @Attach2
EXEC @hr = sp_OAMethod @Mail, 'Send'


IF @hr <> 0
BEGIN
EXEC sp_OAGetErrorInfo @Mail, @src OUT, @desc OUT
SELECT hr=convert(varbinary(4),@hr), Source=@src,
Description=@desc
RETURN
END
GO"

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2005-06-29 : 22:18:00
have you checked the parameter length? the text is probably being truncated

--------------------
keeping it simple...
Go to Top of Page

stoneroses
Starting Member

2 Posts

Posted - 2006-05-23 : 02:31:38
I encountered the following error.Email gets sent but sql returns this error though.

Msg 0, Level 11, State 0, Line 0
A severe error occurred on the current command. The results, if any, should be discarded.
Go to Top of Page
   

- Advertisement -