Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2008-06-09
1
Medium Priority
?
443 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 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

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

Question has a verified solution.

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

I am showing a way to read/import the excel data in table using SQL server 2005... Suppose there is an Excel file "Book1" at location "C:\temp" with column "First Name" and "Last Name". Now to import this Excel data into the table, we will use…
Data architecture is an important aspect in Software as a Service (SaaS) delivery model. This article is a study on the database of a single-tenant application that could be extended to support multiple tenants. The application is web-based develope…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

927 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