Solved

CDONTS error

Posted on 2001-08-27
6
400 Views
Last Modified: 2012-08-13
hello-

im trying to send mail using CDONTS from my W2K server.
The code below actually sends the message, however an error is thrown.

  Method 'Send' of object 'INewMail' failed

so im not exactly sure what the deal is.

thanks - bg



Dim mobjMailer As CDONTS.NewMail

Set mobjMailer = New CDONTS.NewMail
   
mobjMailer.Send "a@b.com", "c@b.com, _
            "fake subject", "fake body"
0
Comment
Question by:BeerGod
  • 3
  • 2
6 Comments
 
LVL 6

Expert Comment

by:JonFish85
ID: 6429387
try this instead of early binding maybe?

Dim mobjMailer As Object

Set mobjMailer = CreateObject("CDONTS.NewMail")
mobjMailer.Send "a@b.com", "c@b.com", "fake subject", "fake body"

hope this helps!
0
 
LVL 6

Expert Comment

by:JonFish85
ID: 6429389
if you just want to get rid of the error, add

On Error Resume Next

before Dim mObjMailer...

hope this helps!
0
 

Author Comment

by:BeerGod
ID: 6429475
yea, the late bind doesnt help. im not sure if i want to skip over these errors, but if i have to i guess i will.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 8

Accepted Solution

by:
Dave_Greene earned 50 total points
ID: 6429486
I think it's because you are not defining a body format.

See this example

    Set oMail = CreateObject("CDONTS.NewMail")
   
    With oMail
       .From = "Support@JDLowry.com"
       .Subject = "Password Request"
       .To = Email
       .BodyFormat = 1
       .MailFormat = 1
       .Body = "Here is your password to access the JD Lowry Member Pages" & vbcrlf & Session("Password")
       .Send
    End With  
     
    Set oMail = Nothing
0
 

Author Comment

by:BeerGod
ID: 6429565
prolly, shouldnt always trust my books.
i got it working another way.
thanks

...
       
Set mobjSession = New CDONTS.Session
        mobjSession.LogonSMTP "SomeGuy", "sg@usa.com"
        Set mobjOutBox = mobjSession.Outbox
        Set mobjMsg = mobjOutBox.Messages.Add
   
        mobjMsg.Subject = "Subject"
        mobjMsg.Text = msMsg
mobjMsg.Recipients.Add "You", "a@b.com"
        mobjMsg.Send
0
 
LVL 6

Expert Comment

by:JonFish85
ID: 6429589
glad you got it working!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
DIR issue 7 50
passing a value with stream reader AFTER a ";" 3 58
clicking a shape in a frame array vb6 3 40
MsgBox 4 45
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

911 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