Solved

CDONTS error

Posted on 2001-08-27
6
411 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

728 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