Solved

Problem getting CDO to work with T-SQL on Windows 2003

Posted on 2008-06-09
1
431 Views
Last Modified: 2008-08-06
I'm having a hard time getting CDO to work from T-SQL on a Win-2003 64 machine.  

Getting a -2147220960 error on the Send method.

Tried both values 1 and 2 for "sendusing" with the same results.

SMTP service is started on the local machine.

Appreciate any help I can get!  Thanks in advance
set	@MessageObject = 'CDO';

EXEC 	@hr = sp_OACreate 'CDO.Message', @MailID Out;

EXEC 	@hr = sp_OASetProperty @MailID, 'Subject', @Subject ;

EXEC 	@hr = sp_OASetProperty @MailID, 'Sender', @From;

EXEC 	@hr = sp_OASetProperty @MailID, 'From', @From;

EXEC 	@hr = sp_OASetProperty @MailID, 'To', @To;

EXEC 	@hr = sp_OASetProperty @MailID, 'BCC', @BCC;

EXEC 	@hr = sp_OASetProperty @MailID, 'TextBody', @Body;

 

EXEC 	@hr = sp_OASetProperty @MailID, 'Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing")', 1;

EXEC 	@hr = sp_OASetProperty @MailID, 'Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver")', '127.0.0.1';

EXEC 	@hr = sp_OASetProperty @MailID, 'Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport")', 25;

EXEC 	@hr = sp_OAMethod @MailID, 'Configuration.Fields.Update', null
 

EXEC 	@hr = sp_OAMethod @MailID, 'Send';

Open in new window

0
Comment
Question by:quiTech
1 Comment
 
LVL 51

Accepted Solution

by:
Ted Bouskill earned 500 total points
ID: 21756677
Why are you using xp_sendmail on SQL 2005?

http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SQL-Server-2005/Q_22972976.html

CDO requires Exchange or MAPI on the server, CDONTS can work without it and is easier to use.
http://support.microsoft.com/kb/312839
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
PERFORMANCE OF SQL QUERY 13 65
SSRS report parameters set after publishing to report manager 1 49
Set the max value for a column 7 36
SQL Restore Script - Syntax Error 8 87
by Mark Wills PIVOT is a great facility and solves many an EAV (Entity - Attribute - Value) type transformation where we need the information held as data within a column to become columns in their own right. Now, in some cases that is relatively…
Introduction This article will provide a solution for an error that might occur installing a new SQL 2005 64-bit cluster. This article will assume that you are fully prepared to complete the installation and describes the error as it occurred durin…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.
This is a video that shows how the OnPage alerts system integrates into ConnectWise, how a trigger is set, how a page is sent via the trigger, and how the SENT, DELIVERED, READ & REPLIED receipts get entered into the internal tab of the ConnectWise …

919 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now