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

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Register Now and get your question answered!
Save Password
Forgot your Password?

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 sql mail xp_processmail
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Posting Yak Master

229 Posts

Posted - 08/02/2005 :  03:30:43  Show Profile  Reply with Quote
Hi all,
Just wondering did anyone can get it going? is it just basicly call this sp? I've got sql mail setup, but everytime when I try to run this, it just gives an error message, so just wondering is there something needs to set before I can use it?

Premature Yak Congratulator

22864 Posts

Posted - 08/02/2005 :  04:07:29  Show Profile  Send madhivanan a Yahoo! Message  Reply with Quote
Try this
@From varchar(255),    
@To varchar(255),   
@Message varchar(8000),   
@Subject varchar(255))  
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'   
EXECUTE @OLEResult = sp_OASetProperty @CDO, 'BodyFormat', 0   
EXECUTE @OLEResult = sp_OASetProperty @CDO, 'MailFormat', 0   
--Call Send method of the object   
execute @OLEResult = sp_OAMethod @CDO, 'Send', Null, @From, @To, @Subject, @Message, 1 --0 is low 1 is normal   
IF @OLEResult <> 0 PRINT 'Send'   
--Destroy CDO   
EXECUTE @OLEResult = sp_OADestroy @CDO   
return @OLEResult


Failing to plan is Planning to fail
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.11 seconds. Powered By: Snitz Forums 2000