sp_OAMethod usage | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

sp_OAMethod usage

Hi all, I am getting a problem in SQL Server 2000 while using the CDOSYS to send the mail. I am getting the following error.
Source: ODSOLE Extended Procedure
Description: sp_OAMethod usage: ObjPointer int IN, MethodName varchar IN [, @returnval <any> OUT [, additional IN, OUT, or BOTH params]]
Text
My code is
————- CREATE procedure sp_send_cdosysmail1
— @From varchar(100) ,
@To varchar(100) ,
@Subject varchar(100)=" ",
@Body varchar(4000) =" " AS
Declare @iMsg int
Declare @hr int
Declare @source varchar(255)
Declare @description varchar(500)
Declare @output varchar(1000)
EXEC @hr = sp_OACreate ‘CDO.Message’, @iMsg OUT EXEC @hr = sp_OASetProperty @iMsg, ‘Configuration.fields("http://schemas.microsoft.com/cdo/configuration/sendusing").Value’,’2′
EXEC @hr = sp_OASetProperty @iMsg, ‘Configuration.fields("http://schemas.microsoft.com/cdo/configuration/smtpserver").Value’, ‘mailservername’
EXEC @hr = sp_OASetProperty @iMsg, ‘Configuration.fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout").Value’, ’10’
EXEC @hr = sp_OASetProperty @iMsg, ‘Configuration.fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport").Value’, ’25’
EXEC @hr = sp_OAMethod @iMsg, ‘Configuration.Fields.Update’, null EXEC @hr = sp_OASetProperty @iMsg, ‘To’, @To
EXEC @hr = sp_OASetProperty @iMsg, ‘From’, "[email protected]"
EXEC @hr = sp_OASetProperty @iMsg, ‘Subject’, @Subject EXEC @hr = sp_OASetProperty @iMsg, ‘TextBody’, @Body
EXEC @hr = sp_OAMethod @iMsg, ‘Send’, NULL IF @hr <>0
select @hr
BEGIN
EXEC @hr = sp_OAGetErrorInfo NULL, @source OUT, @description OUT
IF @hr = 0
BEGIN
SELECT @output = ‘ Source: ‘ + @source
PRINT @output
SELECT @output = ‘ Description: ‘ + @description
PRINT @output
END
ELSE
BEGIN
PRINT ‘ sp_OAGetErrorInfo failed.’
RETURN
END
END EXEC @hr = sp_OADestroy @iMsg
GO
In the "mailservername" i have given the ip address of my smpt server.
Please help me

Please don’t cross post to multiple fora here!
Most members follow all so there is no need for this. See, if you can lock or delete the other post. ———————–
–Frank
http://www.insidesql.de
———————–

could it perhaps be the double quotes around your From parameter "[email protected]"? Cheers
Twan
It was running in one server and not running in another server
Any differences in the service packs on SQL & OS between these 2 servers? Satya SKJ
Moderator
http://www.SQL-Server-Performance.Com/forum
This posting is provided “AS IS” with no rights for the sake of knowledge sharing.
Both servers are have the SQL Server 2000 (Same version and same service pack) Regards
Arunachalam. S
Any information on event viewer or SQL server error log during this behaviour? Satya SKJ
Moderator
http://www.SQL-Server-Performance.Com/forum
This posting is provided “AS IS” with no rights for the sake of knowledge sharing.
No information on log file Regards
Arunachalam. S
]]>