CDONTS.NewMail and SMTP? (ASP 3.0)

Discussion in 'Site Programming, Development and Design' started by yukoandk, May 17, 2013.

  1. Hi,

    I have a rather old ASP project I like put up on my Winhost web server account. I get the (HTTP 500 Internal Server Error) when the page tries to send emails, and I'm guessing I have to include SMTP authorization for my mail account to the script. But I don't know how...

    Can someone show me the light?
    Thank you!

    **********************************************************

    sub SendMail()
    bodyHTML = "<b>Welcome to My Site!</b><br><br>Your user name is: " & username &_
    "<br>Your password is: " & password &_
    "<br>Your email is: " & email &_
    "<br>Your group is: " & category &_
    "<br><br>For questions or comments please send email to <a href='mailto:[email protected]'>[email protected]</a>." &_
    "<br><b>Have a nice day...</b><br><br><img src='smile.gif'>"

    set myMail = server.CreateObject("CDONTS.NewMail")

    myMail.BodyFormat = 0
    myMail.MailFormat = 0
    myMail.From = "[email protected]"
    myMail.To = email
    myMail.Subject = "Welcome, " & username & "!"
    myMail.Body = bodyHTML
    myMail.AttachURL Server.MapPath("smile.gif"), "smile.gif"

    myMail.Send

    set myMail = nothing
    end sub

    **********************************************************
     
    Last edited by a moderator: Oct 14, 2015
  2. Last edited: Oct 14, 2015
  3. Oh I see. I will look into CDO, to keep to the theme of the project. Thank you for your response.

    Can you elaborate on the reason why CDONTS is not supported? Old? Security? Just curious.
     
  4. curtis

    curtis Winhost Staff

    We don't support CDONTS because Microsoft deprecated CDONTS and is no longer supporting it.
     
  5. Got it. Thanks!
     
  6. ComputerMan

    ComputerMan Winhost Staff

    No Problem glad we could help you out ;)
     
  7. Gofer01

    Gofer01 Amateur Web Application Developer

    Well that code stinks. The person gets the body of the message ok but he or she doesn't know who sent the message. In the form. It should request at lease a e-mail address and a submit button

    I'm talking to the guy that gave this link in the above thread

    https://support.Winhost.com/KB/a650/how-to-send-email-in-aspnet.aspx

    Did a real quick search on Google and found this. http://www.asp.net/web-pages/tutorials/email-and-search/11-adding-email-to-your-web-site At lease this code ask for a e-mail address and a subject line
     
    Last edited by a moderator: Oct 14, 2015
  8. It does include a from address, and it's sample code, it isn't meant to be something you can cut and paste into a page and have a perfect one-size-fits-all contact form.
     

Share This Page