Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2003

    Unanswered: ASP mail and CDONTS - check my code please ?

    HI all,

    i am actually sending data to this ASP page from a flash file - i know the data is getting to the page and i have a flag variable sent back to my flash file telling me the script has run - but the script does NOT appear to be sending the email.

    i am sending variables representing the name, email address, subject and message of the user.

    I know it works on my servers at work, but the NOT on the hosting company's servers - i have asked them and they say that CDONTS should work no problem

    can someone check this code for me

    many thanks in advance

    language = "vbscript"
    response.buffer = true

    dim mtext01, mtext02, mtext03, mtext04

    mtext01 = "Name:" & request.form("name") & vbcrlf
    mtext02 = "Email:" & request.form("email") & vbcrlf
    mtext03 = "Comments: " & request.form("message") & vbcrlf
    mtext04 = request.form("subject")

    mtextz = mtext01 & mtext02 & mtext03

    dim MailObj
    set MailObj = server.CreateObject("CDONTS.NewMail")

    if request.form("email") = "" then
    mailObj.From = "No name"
    mailObj.From = request.Form("email")
    end if

    mailObj.To = ""
    mailObj.Body = mtextz
    mailObj.Subject = mtext04
    set MailObj = nothing
    response.write "&emailStatus=E-mail sent successfully"

    What would i need to ask the hosting company?

    i know it works on my win2k servers at work but not at the hosting company


    thanks in advance


  2. #2
    Join Date
    Jun 2003
    Try using CDO instead of CDONTS which is getting phased out.

    You can look over the E-mail Attachment example at
    J. Paul Schmidt, Freelance Web and Database Developer
    Access Database Sample, Web Database Sample, ASP Design Tips

  3. #3
    Join Date
    Feb 2002
    North Wales, UK
    I notice that you are setting the "From:" to the value of a variable. If could be that your host does not allow e-mails to be sent out from addresses that it doesn't know about (i.e. domains that it doesn't host).

    Try hard coding the "From:" field to an e-mail address on your domain and see if the e-mail get's sent.
    J^ - web | email
    newsASP Developer

Posting Permissions

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