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)
 sending mails

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-07-11 : 06:20:12
Ritesh writes "how can I send E-mails through sql server2000,
which is installed on my school pc and that is not in network but it is connected with Internet"

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-07-11 : 06:24:18
See if this helps you
CREATE PROCEDURE SendMail(  
@From varchar(255),
@To varchar(255),
@Message varchar(8000),
@Subject varchar(255))
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'


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


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -