[Last Call] Learn how to a build a cloud-first strategyRegister Now

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

CDONTS error

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
BeerGod
Asked:
BeerGod
  • 3
  • 2
1 Solution
 
JonFish85Commented:
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
 
JonFish85Commented:
if you just want to get rid of the error, add

On Error Resume Next

before Dim mObjMailer...

hope this helps!
0
 
BeerGodAuthor Commented:
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!

 
Dave_GreeneCommented:
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
 
BeerGodAuthor Commented:
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
 
JonFish85Commented:
glad you got it working!
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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