View Single Post
  #1 (permalink)  
Old July 20th, 2006, 06:32 AM
ilknur ilknur is offline
Registered User
 
Join Date: Jul 2006
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Source: CDO.Message.1 please help me:)

my stored procedure gives me the following error:

 Source: CDO.Message.1
 Description: The "SendUsing" configuration value is invalid.

the sp that i use is like this:

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO



/*
sp_Account_EmailSEND 1
sp_Send_MailHtml 'AA','BB','',''
*/

ALTER PROCEDURE [dbo].[sp_Send_MailHtml]
    @From varchar(100) ,
    @To varchar(100) ,
    @Subject varchar(100)=" ",
    @Body varchar(8000) =" "
/************************************************** *******************
This stored procedure takes the parameters and sends an e-mail.
All the mail configurations are hard-coded in the stored procedure.
Comments are added to the stored procedure where necessary.
References to the CDOSYS objects are at the following MSDN Web site:
http://msdn.microsoft.com/library/de...l=/library/en-
us/cdosys/html/_cdosys_messaging.asp
************************************************** *******************/
--with encryption
AS
Declare @iMsg int
declare @config int
Declare @hr int
Declare @source varchar(255)
Declare @description varchar(500)
Declare @output varchar(1000), @serveraddress varchar(1000)
--set @serveraddress = '10.10.10.2'
DECLARE @src varchar(255), @desc varchar(255)
--************* Create the CDO.Message Object ************************
EXEC @hr = sp_OACreate 'CDO.Message', @iMsg OUT
EXEC @hr = sp_OACreate 'CDO.Configuration', @config OUT
--***************Configuring the Message Object ******************
EXEC @hr = sp_OASetProperty @config, 'Fields(cdoSendUsingMethod)', 'cdoSendUsingPort' -- Send the message using the network
EXEC @hr = sp_OASetProperty @config, 'Fields(cdoSMTPServer)', '10.1.1.16' -- SMTP Server
EXEC @hr = sp_OASetProperty @config, 'Fields(cdoSMTPServerPort)', 25 -- Server SMTP Port
EXEC @hr = sp_OASetProperty @config, 'Fields(cdoSMTPAuthenticate)', 'cdoAnonymous' -- Anonymous SMTP Authenticate
EXEC sp_OAMethod @config, 'Fields.Update'
------------------------------------------------------------------
-- This is to configure a remote SMTP server.
-- http://msdn.microsoft.com/library/de...l=/library/en- us/cdosys/html/_cdosys_schema_configuration_sendusing.asp
----EXEC @hr = sp_OASetProperty @iMsg
--, 'Configuration.fields("http://schemas.microsoft.com/cdo/configuration/se ndusing").Value','2'
-- This is to configure the Server Name or IP address.
-- Replace MailServerName by the name or IP of your SMTP Server.
----EXEC @hr = sp_OASetProperty @iMsg
--,'Configuration.fields("http://schemas.microsoft.com/cdo/configuration/sm tpserver").Value', 'MailServerName'
-- Save the configurations to the message object.
----EXEC @hr = sp_OAMethod @iMsg, 'Configuration.Fields.Update', null
-- Set the e-mail parameters.
EXEC @hr = sp_OASetProperty @iMsg, 'To', @To
EXEC @hr = sp_OASetProperty @iMsg, 'From', @From
EXEC @hr = sp_OASetProperty @iMsg, 'HTMLBody', @Subject
-- If you are using HTML e-mail, use 'HTMLBody' instead of 'TextBody'.
EXEC @hr = sp_OASetProperty @iMsg, 'TextBody', @Body
EXEC @hr = sp_OAMethod @iMsg, 'Send', NULL
-- Sample error handling.
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
-- Do some error handling after each step if you have to.
-- Clean up the objects created.
EXEC @hr = sp_OADestroy @iMsg
EXEC @hr = sp_OADestroy @config

-- Errorhandler
IF @hr <> 0
BEGIN
EXEC sp_OAGetErrorInfo @iMsg, @src OUT, @desc OUT
SELECT hr=convert(varbinary(4),@hr), Source=@src, Description=@desc
RETURN
end

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




GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO


i tried lots of things but i could not find the reason of the error,so there is a little time to solve this.please help me to solve the problem.
thanks

Reply With Quote