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

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 664
  • Last Modified:

Trying to use CDONTS on XP to send e-mail

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
yvsupport
Asked:
yvsupport
2 Solutions
 
mladenoviczCommented:
I am not sure, but I think that you need CDO.dll and GAPI32.DLL
0
 
Ryan ChongCommented:
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
 
Ryan ChongCommented:
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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
yvsupportAuthor Commented:
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
 
aelatikCommented:
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
 
yvsupportAuthor Commented:
Working.

Will split the points between ryancys and aelatik

half each.

cheers guys.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now