Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2008-06-09
1
Medium Priority
?
442 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 51

Accepted Solution

by:
Ted Bouskill earned 1500 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

There are some very powerful Dynamic Management Views (DMV's) introduced with SQL 2005. The two in particular that we are going to discuss are sys.dm_db_index_usage_stats and sys.dm_db_index_operational_stats.   Recently, I was involved in a di…
I've encountered valid database schemas that do not have a primary key.  For example, I use LogParser from Microsoft to push IIS logs into a SQL database table for processing and analysis.  However, occasionally due to user error or a scheduled task…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

719 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