Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2000 > SQL Server 2000
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 20th, 2006, 06:32 AM
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:


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:
************************************************** *******************/
--with encryption
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 = ''
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)', '' -- 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
    EXEC @hr = sp_OAGetErrorInfo NULL, @source OUT, @description OUT
    IF @hr = 0
    SELECT @output = ' Source: ' + @source
    PRINT @output
    SELECT @output = ' Description: ' + @description
    PRINT @output
    PRINT ' sp_OAGetErrorInfo failed.'
-- 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
EXEC sp_OAGetErrorInfo @iMsg, @src OUT, @desc OUT
SELECT hr=convert(varbinary(4),@hr), Source=@src, Description=@desc

IF @hr <>0
-- select @hr
    EXEC @hr = sp_OAGetErrorInfo NULL, @source OUT, @description OUT
    IF @hr = 0
    SELECT @output = ' Source: ' + @source
    PRINT @output
    SELECT @output = ' Description: ' + @description
    PRINT @output
    PRINT ' sp_OAGetErrorInfo failed.'


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.

Reply With Quote
  #2 (permalink)  
Old July 23rd, 2006, 12:52 PM
Friend of Wrox
Join Date: Dec 2005
Location: , AZ, .
Posts: 146
Thanks: 0
Thanked 1 Time in 1 Post

Take a look at this http://www.sqldev.net/xp/xpsmtp.htm
This XP has been used by many and is well tested.

David Lundell
Principal Consultant and Trainer
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help related CDO.Message shankhan Classic ASP Basics 9 January 2nd, 2005 07:08 PM

All times are GMT -4. The time now is 06:23 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.