Solved

CDONTS error

Posted on 2001-08-27
6
401 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
Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

 
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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
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…

777 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