SitePoint Sponsor

User Tag List

Results 1 to 11 of 11
  1. #1
    SitePoint Zealot Taranis's Avatar
    Join Date
    Aug 2002
    Location
    Franklin, TN
    Posts
    197
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    CDONTS Mail Error

    I am trying to send two emails based on a successful Record Update in the DB. I am getting very erratic behavior from my script. Here's the code:
    Code:
          Dim myMail
    	Dim myMail2
    	Dim strMessage
    	Dim strMessage2
    	
    	strMessage = "A new job application has been completed on the website."
    		
    	Set myMail = CreateObject("CDONTS.NewMail")
    	myMail.From = "me@site.com"
    	myMail.To = "me@mail.com"
    	myMail.Subject = "New Employment Application"
    	myMail.Body = strMessage
    	myMail.Send
    	Set myMail = Nothing 
    	
    	strMessage2 = "Thank you for your application."
    		
    	Set myMail2 = CreateObject("CDONTS.NewMail")
    	myMail2.From = "mail@site.com"
    	'myMail.To = strEmail
    	myMail2.To = "me@mail.com"
    	myMail2.Subject = "Your Employment Application"
    	myMail2.Body = strMessage2
    	myMail2.Send
    	Set myMail2 = Nothing
    Sometimes, the second email kicks back an error and sometimes it doesn't. Does anyone know why or have a better way to send two different emails to two different addresses? Currently, they both go to the same place for testing. Email addresses have been changed to protect the innocent.

  2. #2
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,236
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Can you post the error and any other details you can provide us with? From the looks of your code all seems OK, it may be an issue with configuring the SMTP service on your server.

    --Vinnie

  3. #3
    SitePoint Zealot Taranis's Avatar
    Join Date
    Aug 2002
    Location
    Franklin, TN
    Posts
    197
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is the error I get
    Code:
    error '80070020' 
    /employ/empform/handleApp.asp, line 523
    The line number corresponds to the line
    Code:
    myMail2.Send
    The only other details I can provide are that the first email gets sent fine. I also have other pages that send two emails using a third-party plug-in component that seem to work fine. So, maybe the problem is in the CDONTS setup? Also, this box is not the email server. The email is handled on another machine, could that have an effect?

  4. #4
    SitePoint Wizard wdmny's Avatar
    Join Date
    Jul 2000
    Location
    Here
    Posts
    1,010
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm not sure if this will solve your problem, but shouldn't you use Server.CreateObject rather than just CreateObject?

  5. #5
    SitePoint Zealot Taranis's Avatar
    Join Date
    Aug 2002
    Location
    Franklin, TN
    Posts
    197
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by Wes DeMoney
    I'm not sure if this will solve your problem, but shouldn't you use Server.CreateObject rather than just CreateObject?
    I definitely should have that there. That's what I get for copying and pasting code from older test projects.

    At any rate, I am still getting the same error. The first mail gets sent, but the second one doesn't.

    Thanks for the keen eyes.

  6. #6
    \m/ R.I.P. Dimebag! \m/ JimBolla's Avatar
    Join Date
    Dec 2001
    Location
    erie, pa
    Posts
    1,130
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    what happens if you comment out all the first email sending code? then does the second one still have problems?
    -- JIM BOLLA
    Wanna play Halo 2? My XBOX Live gamertag: crowdozer

  7. #7
    SitePoint Zealot Taranis's Avatar
    Join Date
    Aug 2002
    Location
    Franklin, TN
    Posts
    197
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by crowdozer
    what happens if you comment out all the first email sending code? then does the second one still have problems?
    If I comment out the first, the second works fine. Then when I put them both back in, the first started to give errors.

    I decided to scrap using CDONTS and just use a 3rd party component that we have installed on the server already.

    I wanted to try to use CDONTS because it's native and it seems faster, but this is too much headache. I figure there must be some configuration problem with the CDONTS.

  8. #8
    SitePoint Enthusiast
    Join Date
    Aug 2002
    Posts
    42
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    A long shot this, but try using only 1 cdonts.newmail object and re-use it for the second e-mail?

    Regards, Ed.

  9. #9
    SitePoint Zealot Taranis's Avatar
    Join Date
    Aug 2002
    Location
    Franklin, TN
    Posts
    197
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by mrTed
    A long shot this, but try using only 1 cdonts.newmail object and re-use it for the second e-mail?
    Good idea, but no dice. I still think it's a config problem with CDONTS because now I can't even get one mail to send.

    I have that 3rd-party component and it works fine. Just wanted to try to learn something new.

    Thanks for all the help and ideas.

  10. #10
    SitePoint Enthusiast
    Join Date
    Aug 2002
    Posts
    42
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    Worth a go. I guess you could try re-installing the smtp service and/or cdonts.dll?

    Regards, Ed.

  11. #11
    \m/ R.I.P. Dimebag! \m/ JimBolla's Avatar
    Join Date
    Dec 2001
    Location
    erie, pa
    Posts
    1,130
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    if you're using windows 2000, try using CDOSYS instead of CDONTS.
    -- JIM BOLLA
    Wanna play Halo 2? My XBOX Live gamertag: crowdozer


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •