Solved

Trying to use CDONTS on XP to send e-mail

Posted on 2004-08-25
6
641 Views
Last Modified: 2010-08-05
I am trying to use CDONTS to send emails without using outlook etc.

When I try to instantiate the object I get the following:
Runtime Error '-2147024770 (8007007e)':
Automation error
The specified module could not be found

from this code:
Dim objNewMail As Object
Set objNewMail = CreateObject("CDONTS.NewMail")

I have tried to unregister the CDONTS.DLL to try and re-register it but get the following error:
Loadlibrary("C:\windows\system32\cdonts.dll") failed. The specified module could not be found

Can anyone help me here?
0
Comment
Question by:yvsupport
6 Comments
 
LVL 8

Expert Comment

by:mladenovicz
ID: 11891112
I am not sure, but I think that you need CDO.dll and GAPI32.DLL
0
 
LVL 49

Accepted Solution

by:
Ryan Chong earned 125 total points
ID: 11891202
Try use CDOSYS instead, here is an example:

<%
Dim MyMail
Set MyMail = CreateObject("CDO.Message")
MyMail.From = "sender@yourdomain.com"
MyMail.To = "receiver1@domain.com"
MyMail.Cc = "receiver2@domain.com;receiver3@domain.com"
MyMail.Bcc = "receiver4@domain.com"
MyMail.Subject = "my subject"
MyMail.TextBody = "Hello world... "
MyMail.AddAttachment "c:\test.gif"
MyMail.Send()
Set MyMail = Nothing
%>
0
 
LVL 49

Expert Comment

by:Ryan Chong
ID: 11891239
See explaination and suggested solution by amit_g and GaryC123 at: http:Q_20649064.html

GaryC123 wrote:

Cdonts doesn't come with XP!
You can get a copy of it here
http://dll.yaroslavl.ru/index.php3?lng=&in_char=C

and then in a dos prompt type

regsvr32 C:\windows\SYSTEM32\cdonts.dll
0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

Author Comment

by:yvsupport
ID: 11893588
I am having trouble unregistering the cdonts.dll and then re-registering it....

I have also tried the CDOSYS method and whilst the code runs, I get no mail received. Do I have to configure anything?
0
 
LVL 14

Assisted Solution

by:aelatik
aelatik earned 125 total points
ID: 11895031
Yes you need to configure CDO first, add this to ryancys's post.

Set CON = CreateObject("CDO.Configuration")
        CON.Fields("cdo/configuration/smtpserver">http://schemas.microsoft.com/cdo/configuration/smtpserver") = "255.255.255.255"
        CON.Fields("cdo/configuration/smtpserverport">http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
        CON.Fields("cdo/configuration/sendusing">http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
        CON.Fields("cdo/configuration/smtpconnectiontimeout">http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
        CON.Fields.Update
Set MyMail.Configuration = CON

So it would be like this :

Dim MyMail
Set MyMail = CreateObject("CDO.Message")
Set CON = CreateObject("CDO.Configuration")
        CON.Fields("cdo/configuration/smtpserver">http://schemas.microsoft.com/cdo/configuration/smtpserver") = "255.255.255.255"
        CON.Fields("cdo/configuration/smtpserverport">http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
        CON.Fields("cdo/configuration/sendusing">http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
        CON.Fields("cdo/configuration/smtpconnectiontimeout">http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
        CON.Fields.Update
Set MyMail.Configuration = CON
MyMail.From = "sender@yourdomain.com"
MyMail.To = "receiver1@domain.com"
MyMail.Cc = "receiver2@domain.com;receiver3@domain.com"
MyMail.Bcc = "receiver4@domain.com"
MyMail.Subject = "my subject"
MyMail.TextBody = "Hello world... "
MyMail.AddAttachment "c:\test.gif"
MyMail.Send()
Set MyMail = Nothing

Good luck,
Ayhan Elatik
0
 

Author Comment

by:yvsupport
ID: 11989362
Working.

Will split the points between ryancys and aelatik

half each.

cheers guys.
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

759 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

19 Experts available now in Live!

Get 1:1 Help Now