Hello,
I am attempting to send emails using T-SQL (in a SQLServerAgent Job)
using the stored procedure sp_SendSMTPMail . I created the stored proc
using the following script that I got off a post here on google.
CREATE PROCEDURE sp_SendSMTPMail (@From varchar(255),
@To varchar(8000),
@Subject varchar(255),
@Body varchar(8000),
@cc varchar(8000) = NULL,
@Bcc varchar(8000) = NULL)
AS
DECLARE @newmail int
DECLARE @result int
-- Create the CDONTS.Newmail object
EXEC @result = sp_OACreate 'CDONTS.NewMail ', @newmail OUT
IF @result <> 0
BEGIN
PRINT 'Error creating object'
EXEC sp_displayoaerr orinfo @newmail, @result
RETURN
END
-- Check the Optional Properties
IF not @cc = NULL
BEGIN
EXEC @result = sp_OASetPropert y @newmail, 'cc', @cc
IF @result <> 0
BEGIN
PRINT 'Error setting [cc] property'
-- EXEC sp_displayoaerr orinfo @newmail, @result
RETURN
END
END
IF not @Bcc = NULL
BEGIN
EXEC @result = sp_OASetPropert y @newmail, 'Bcc', @Bcc
IF @result <> 0
BEGIN
PRINT 'Error setting [Bcc] property'
-- EXEC sp_displayoaerr orinfo @newmail, @result
RETURN
END
END
--set the non-optional properties
EXEC @result = sp_OASetPropert y @newmail, 'From', @From
EXEC @result = sp_OASetPropert y @newmail, 'To', @To
EXEC @result = sp_OASetPropert y @newmail, 'Subject', @Subject
EXEC @result = sp_OASetPropert y @newmail, 'Body', @Body
-- Send the message...
EXEC @result = sp_OAMethod @newmail, 'Send'
IF @result <> 0
BEGIN
PRINT 'Error sending message'
-- EXEC sp_displayoaerr orinfo @newmail, @result
RETURN
END
-- Destroy the object.
EXEC @result = sp_OADestroy @newmail
IF @result <> 0
BEGIN
PRINT'Error destroying object'
-- EXEC sp_displayoaerr orinfo @newmail, @result
RETURN
END
GO
_______________ _______________ _______________ _
This worked perfectly in testing at our office but when we shipped to
the client it produced the error 'Error creating object'. We sent the
client the script to create the sp_displayoaerr orinfo proc and got the
following error message.
Error creating object-2147221005
OLE Automation Error Information
HRESULT: 0x800401f3
Source: ODSOLE Extended Procedure
Description: Invalid class string
Now this suggested to me that the for some reason we were unable to
reference the CDO library, or it wasn't installed. However they have
Outlook 2000 installed with CDO installed with it. I've had had them
remove and reinstall the CDO library but that hasn't helped.
Other thing I though of was a permission type problem. They are using
NT authentication for there logins into SQL server and are logged on
the server as Administrator who I would assume has all required
permissions.
Any suggestions for either determining the cause of them problems or a
solution?
Thanks in advance.
Bob. 3 7062
Hi
You may want to look at: http://www.sqldev.net/xp/xpsmtp.htm
John
"Robert Hogan" <bu*******@hotm ail.com> wrote in message
news:eb******** *************** **@posting.goog le.com... Hello,
I am attempting to send emails using T-SQL (in a SQLServerAgent Job) using the stored procedure sp_SendSMTPMail . I created the stored proc using the following script that I got off a post here on google.
CREATE PROCEDURE sp_SendSMTPMail (@From varchar(255), @To varchar(8000), @Subject varchar(255), @Body varchar(8000), @cc varchar(8000) = NULL, @Bcc varchar(8000) = NULL) AS
DECLARE @newmail int DECLARE @result int
-- Create the CDONTS.Newmail object EXEC @result = sp_OACreate 'CDONTS.NewMail ', @newmail OUT IF @result <> 0 BEGIN PRINT 'Error creating object' EXEC sp_displayoaerr orinfo @newmail, @result RETURN END
-- Check the Optional Properties IF not @cc = NULL BEGIN EXEC @result = sp_OASetPropert y @newmail, 'cc', @cc IF @result <> 0 BEGIN PRINT 'Error setting [cc] property' -- EXEC sp_displayoaerr orinfo @newmail, @result RETURN END END IF not @Bcc = NULL BEGIN EXEC @result = sp_OASetPropert y @newmail, 'Bcc', @Bcc IF @result <> 0 BEGIN PRINT 'Error setting [Bcc] property' -- EXEC sp_displayoaerr orinfo @newmail, @result RETURN END END
--set the non-optional properties EXEC @result = sp_OASetPropert y @newmail, 'From', @From EXEC @result = sp_OASetPropert y @newmail, 'To', @To EXEC @result = sp_OASetPropert y @newmail, 'Subject', @Subject EXEC @result = sp_OASetPropert y @newmail, 'Body', @Body
-- Send the message... EXEC @result = sp_OAMethod @newmail, 'Send' IF @result <> 0 BEGIN PRINT 'Error sending message' -- EXEC sp_displayoaerr orinfo @newmail, @result RETURN END
-- Destroy the object. EXEC @result = sp_OADestroy @newmail IF @result <> 0 BEGIN PRINT'Error destroying object' -- EXEC sp_displayoaerr orinfo @newmail, @result RETURN END
GO
_______________ _______________ _______________ _ This worked perfectly in testing at our office but when we shipped to the client it produced the error 'Error creating object'. We sent the client the script to create the sp_displayoaerr orinfo proc and got the following error message.
Error creating object-2147221005 OLE Automation Error Information HRESULT: 0x800401f3 Source: ODSOLE Extended Procedure Description: Invalid class string
Now this suggested to me that the for some reason we were unable to reference the CDO library, or it wasn't installed. However they have Outlook 2000 installed with CDO installed with it. I've had had them remove and reinstall the CDO library but that hasn't helped.
Other thing I though of was a permission type problem. They are using NT authentication for there logins into SQL server and are logged on the server as Administrator who I would assume has all required permissions.
Any suggestions for either determining the cause of them problems or a solution?
Thanks in advance.
Bob.
"John Bell" <jb************ @hotmail.com> wrote in message news:<41******* *************** *@news.easynet. co.uk>... Hi
You may want to look at: http://www.sqldev.net/xp/xpsmtp.htm
John
The client is using Exchange Server, the dll you have referenced using
SMTP to send the messages - will these work together?
I have made some progress on sorting out the original problem. I
registered two CDO Dll's that documentation lead me to believe were
needed (CDOSYS.DLL and CDO.DLL I think off the top of my head) and the
create object error went away. However I'm now getting an error when
attempting to send the message. I think the problem is with the
installation of CDO, sadly the client has 'lost' the CD used to
install Office 2000 on that server and will have to acquire another -
but can't wait that long for a solution so I will have to look at a
third party solution I suspect.
I have used JMail before but this didn't seem to work when I tried it
here, again this uses SMTP and I'm not sure that Exchange Server will
(by default) provide an SMTP mail server?
Any help very much apprecitated.
Hi
I have only just found this reply! Have you figured out what was
wrong?
If you are using your exchange server to send/receive external emails
then you should have the SMTP connector configured.
John bu*******@hotma il.com (Robert Hogan) wrote in message news:<eb******* *************** ***@posting.goo gle.com>... "John Bell" <jb************ @hotmail.com> wrote in message news:<41******* *************** *@news.easynet. co.uk>... Hi
You may want to look at: http://www.sqldev.net/xp/xpsmtp.htm
John
The client is using Exchange Server, the dll you have referenced using SMTP to send the messages - will these work together?
I have made some progress on sorting out the original problem. I registered two CDO Dll's that documentation lead me to believe were needed (CDOSYS.DLL and CDO.DLL I think off the top of my head) and the create object error went away. However I'm now getting an error when attempting to send the message. I think the problem is with the installation of CDO, sadly the client has 'lost' the CD used to install Office 2000 on that server and will have to acquire another - but can't wait that long for a solution so I will have to look at a third party solution I suspect.
I have used JMail before but this didn't seem to work when I tried it here, again this uses SMTP and I'm not sure that Exchange Server will (by default) provide an SMTP mail server?
Any help very much apprecitated. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Carlos G Benevides |
last post by:
I have a ASP.Net web application that has two assemblies that run
under com+. Under Windows 2000 the two assemblies are added to com+
automatically when instantiated from the web site. For this to happen
we had to change the context in which asp.net runs from machine to
SYSTEM by modifying the machine.config file. Under Windows 2003 no
matter how asp.net is set to run as either machine or system. I get
the following error:
...
|
by: Pankaj Jain |
last post by:
Hi All,
I have a class A which is derived from ServicesComponent to participate in automatic transaction with falg Transaction.Required. Class A is exposed to client through remoting on Http channal hosting into IIS.
There is a class B which is also available through remoting hosted on IIS on the same URI. B creates new of A inside a function. It succeed and able to create instance of A inside B first time. But it failes in 2nd attempt when...
|
by: hrhoe |
last post by:
Hi,
I'm trying to create a reusable component with C#.
So, I created a user control that uses Microsoft SQLDMO
Object Library (SQLDMO).
And I could add that UserControl on Toolbox.
However, whenever I'm trying to add this user control on
the client program's form I'm getting the following error
message.
----------------------
|
by: SampathTangudu |
last post by:
Hi,
We are trying to use the Hash Tables for passing information from one aspx
page to another aspx page. We are using the below code.
IsolatedStorageFile isoStore = IsolatedStorageFile.GetStore(
IsolatedStorageScope.User
| IsolatedStorageScope.Assembly |IsolatedStorageScope.Domain , null, null
);
|
by: Imran Aziz |
last post by:
Hello All,
I am getting the following error on our production server, and I dont
get the same error on the development box.
Unable to cast object of type 'System.Byte' to type 'System.String'.
here is the code that I used to create a table and then add columns to it
later, later I populate the rows in the table.
| |
by: bazzer |
last post by:
hey,
im trying to access a microsoft access database from an ASP.NET web
application in visual basic 2003.NET. i get the following error when i
try running it:
Server Error in '/CinemaBookingSystem' Application.
--------------------------------------------------------------------------------
ERROR General error
Unable to open registry key 'Temporary (volatile) Jet DSN for process
|
by: ashishjainism |
last post by:
I am unable to install my windows service and the installutil is throwing the following error:
Running a transacted installation.
Beginning the Install phase of the installation.
See the contents of the log file for the d:\practice in .net\mywindowsservice\mywindowsservice\mywindowsservice\bin\practiceservice.exe assembly's progress.
The file is located at d:\practice in...
|
by: Buddy Home |
last post by:
Hello,
I'm trying to upload a file programatically and occasionally I get the
following error message.
Unable to write data to the transport connection: An established connection
was aborted by the software in your host machine.
Stack Trace
at System.Net.Sockets.NetworkStream.Write(Byte buffer, Int32 offset, Int32
|
by: Buddy Home |
last post by:
Hello,
I'm trying to upload a file programatically and occasionally I get the
following error message.
Unable to write data to the transport connection: An established connection
was aborted by the software in your host machine.
Stack Trace
at System.Net.Sockets.NetworkStream.Write(Byte buffer, Int32 offset, Int32
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |