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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

not receiving Message, what is wrong...?

Status
Not open for further replies.

jawan

MIS
Joined
Apr 22, 2003
Messages
153
Location
US
CREATE PROCEDURE xp_cdosendmail(
@Address varchar(255),
@Message varchar(8000),
@Subject varchar(255),
@From varchar(255) = 'ABCUSA@hotmail.com') AS

DECLARE @CDO int, @OLEResult int, @Out int

--Create CDONTS.NewMail object
EXECUTE @OLEResult = sp_OACreate 'CDONTS.NewMail', @CDO OUT
IF @OLEResult <> 0 PRINT 'CDONTS.NewMail'

--Call Send method of the object
execute @OLEResult = sp_OAMethod @CDO, 'Send', Null, @From, @Address, @Subject, @Message, 0
IF @OLEResult <> 0 PRINT 'Send'

--Destroy CDO
EXECUTE @OLEResult = sp_OADestroy @CDO

return @OLEResult


execute xp_cdosendmail 'abc@yahoo.com','Test Message','Test'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top