Solved

CDONTS error

Posted on 2001-08-27
6
398 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
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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…
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…

746 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

12 Experts available now in Live!

Get 1:1 Help Now