Solved

Trying to use CDONTS on XP to send e-mail

Posted on 2004-08-25
6
643 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 50

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 50

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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

813 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

13 Experts available now in Live!

Get 1:1 Help Now