Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Sending mail using CDONTS and Sql Server Expand / Collapse
Author
Message
Posted Sunday, September 23, 2007 6:18 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Tuesday, February 27, 2007 5:00 PM
Points: 18, Visits: 1
Comments posted to this topic are about the item Sending mail using CDONTS and Sql Server


Post #401750
Posted Sunday, December 12, 2010 11:13 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Sunday, December 12, 2010 12:03 PM
Points: 1, Visits: 7
Will this still work on a server running in 64 bit.

I am getting this message
SQL Mail does not work with the 64-bit version of SQL Server Microsoft SQL Error 17938
Post #1033496
Posted Tuesday, January 10, 2012 7:33 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: 2 days ago @ 7:39 AM
Points: 321, Visits: 1,294
whats is CDONTS and it will send query result in mail?

Aim to inspire rather than to teach.
SQL Server DBA
Post #1233216
Posted Monday, April 2, 2012 9:15 AM


SSCarpal Tunnel

SSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal Tunnel

Group: General Forum Members
Last Login: Thursday, December 11, 2014 1:06 PM
Points: 4,253, Visits: 4,295
I could not get Database Mail to work on a Server so I tried CDONTS.

I used the following code:

DECLARE @From varchar(100)
DECLARE @To varchar(100)

DECLARE @Subject varchar(100)
DECLARE @Body varchar(4000)

DECLARE @CC varchar(100)
DECLARE @BCC varchar(100)

SET @CC = Null
SET @BCC = Null

DECLARE @MailID int
DECLARE @hr int

SET @From = 'jblow@.com'
SET @To = 'jblow@.com'

SET @Subject = 'Testing'

SET @Body = 'Testing'

EXEC @hr = sp_OACreate 'CDONTS.NewMail', @MailID OUT
EXEC @hr = sp_OASetProperty @MailID, 'From',@From
EXEC @hr = sp_OASetProperty @MailID, 'Body', @Body
EXEC @hr = sp_OASetProperty @MailID, 'BCC',@BCC
EXEC @hr = sp_OASetProperty @MailID, 'CC', @CC
EXEC @hr = sp_OASetProperty @MailID, 'Subject', @Subject
EXEC @hr = sp_OASetProperty @MailID, 'To', @To
EXEC @hr = sp_OAMethod @MailID, 'Send', NULL
EXEC @hr = sp_OADestroy @MailID

I get command executed sucessfully.

I can sent via telnet but no other method works.

Any suggestions?



For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/

For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/

Post #1276695
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse