ASP Mail - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

ASP Mail

below is my asp code for send mail through the form, but when i testing,only the last line of code working that is redirect. can anyone help me to check any error?

<%
' Declare Variables
Dim objNewMail, strFilePath

' Create Instance of NewMail Object
Set objNewMail = Server.CreateObject("CDONTS.NewMail")
' Set Email Priority (1 = Normal)
objNewMail.Importance = 1
' Send plain text email
objNewMail.BodyFormat = 1
' Senders email address
objNewMail.From = request.querystring("name")
' Recipients email address
objNewMail.To = "techsupport@allit.com.my"
' Email Subject
objNewMail.Subject = "enquiry"
' Email Body
objNewMail.Body = request.querystring("enquiry")
' Send Email
objNewMail.Send()
' Destroy object to release it from memory
Set objNewMail = Nothing

response.Redirect("thankyou.htm")
%>

Comments

  • FlakesFlakes Posts: 642Member
    : below is my asp code for send mail through the form, but when i testing,only the last line of code working that is redirect. can anyone help me to check any error?
    :
    : <%
    : ' Declare Variables
    : Dim objNewMail, strFilePath
    :
    : ' Create Instance of NewMail Object
    : Set objNewMail = Server.CreateObject("CDONTS.NewMail")
    : ' Set Email Priority (1 = Normal)
    : objNewMail.Importance = 1
    : ' Send plain text email
    : objNewMail.BodyFormat = 1
    : ' Senders email address
    : objNewMail.From = request.querystring("name")
    : ' Recipients email address
    : objNewMail.To = "techsupport@allit.com.my"
    : ' Email Subject
    : objNewMail.Subject = "enquiry"
    : ' Email Body
    : objNewMail.Body = request.querystring("enquiry")
    : ' Send Email
    : objNewMail.Send()
    : ' Destroy object to release it from memory
    : Set objNewMail = Nothing
    :
    : response.Redirect("thankyou.htm")
    : %>
    :


    Check your mailroot folder to see whther the mail is going to any of the folders(drop/queue/badmail etc.) inside mailroot.

    Also ,the from mailid has to be a valid one.


  • litterlitter Posts: 23Member

    i had check, is no error over this. is there any other method to send mail with form ?
  • FlakesFlakes Posts: 642Member
    :
    : i had check, is no error over this. is there any other method to send mail with form ?
    :


    yes there are some free components,which you have to install in your system.ASPMail,I think is there,do a google for it.

    Your code should have worked,dont know why it doesnt.maybe there is something wrong with the configurations...

    If you are using XP,you have to use CDO.Message instead of CDONTS.Newmail..


  • litterlitter Posts: 23Member
    this is not my machine, i am remote to my hosting. i dont know what OS of the machine. Maybe can u try to go there and check?
    www.allit.com.my/test/wwwroot/customer.asp
  • FlakesFlakes Posts: 642Member
    : this is not my machine, i am remote to my hosting. i dont know what OS of the machine. Maybe can u try to go there and check?
    : www.allit.com.my/test/wwwroot/customer.asp
    :


    Then you could ask the hosting company why this is happening and if there are other options available.

    You do have a mailid called techsupport@allit.com.my ??


  • litterlitter Posts: 23Member
    yes i have.
    Thanks for helping, i received your testing email already
  • FlakesFlakes Posts: 642Member
    : yes i have.
    : Thanks for helping, i received your testing email already
    :


    I tried your code from here,giving hard coded values instead of those request values,and its working fine.So your code is fine.

    Hope you get it to work.
  • FlakesFlakes Posts: 642Member
    : : yes i have.
    : : Thanks for helping, i received your testing email already
    : :
    :
    :
    : I tried your code from here,giving hard coded values instead of those request values,and its working fine.So your code is fine.
    :
    : Hope you get it to work.
    :


    Paste this at the top of your page,before all the email code:
    [code]
    Response.Write "Name=" & request.querystring("name") &"
    "
    Response.Write "Enquiry=" & request.querystring("enquiry")
    Response.End
    [/code]

    Do you see what you expected?
    otherwise your code should work.

Sign In or Register to comment.