1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

My contact form isn't sending emails,help please!

Discussion in 'C#' started by Ellablue, Feb 26, 2008.

  1. #1
    I've tried several different contact form templates(because I don't know enough to create my own), and none have worked correctly. This is my 6th, and it seems to finally be working with no error mssgs. etc., but it's still not sending the form through to the email address. Here is the link:
    http://www.bigleagueskillsllc.com/contact.html

    and here is the asp page:

    <title>contact.asp</title><%
    ' declare variables
    Dim ContactName
    Dim ContactPhone
    Dim ContactEmail
    Dim ContactAddress
    Dim StudentsName
    Dim YearofHighSchoolGraduation
    Dim StudentsSATscores
    Dim StudentsGPA
    Dim PleasetypeallthatapplyIaminterestedinAlltypesoffinancialaidscholarshipsAthleticscholarshipsonlySkilldevelopmentforbaseballonly
    Dim PleasetypeallthatapplyCollegepreferencesInstateOutofstatePublicPrivate

    ' get posted data into variables
    EmailTo = "k.anderson.design@gmail.com"
    ContactName = Trim(Request.Form("ContactName"))
    ContactPhone = Trim(Request.Form("ContactPhone"))
    ContactEmail = Trim(Request.Form("ContactEmail"))
    ContactAddress = Trim(Request.Form("ContactAddress"))
    StudentsName = Trim(Request.Form("StudentsName"))
    YearofHighSchoolGraduation = Trim(Request.Form("YearofHighSchoolGraduation"))
    StudentsSATscores = Trim(Request.Form("StudentsSATscores"))
    StudentsGPA = Trim(Request.Form("StudentsGPA"))
    PleasetypeallthatapplyIaminterestedinAlltypesoffinancialaidscholarshipsAthleticscholarshipsonlySkilldevelopmentforbaseballonly = Trim(Request.Form("PleasetypeallthatapplyAlltypesoffinancialaidscholarshipsAthleticscholarshipsonlySkilldevelopmentforbaseballonly"))
    PleasetypeallthatapplyCollegepreferencesInstateOutofstatePublicPrivate = Trim(Request.Form("PleasetypeallthatapplyCollegepreferencesInstateOutofstatePublicPrivate"))

    ' validation
    Dim validationOK
    validationOK=true
    If (Trim(EmailTo)="") Then validationOK=false
    If (validationOK=false) Then Response.Redirect("error.htm?" & EmailFrom)

    ' prepare email body text
    Dim Body
    Body = Body & "ContactName: " & ContactName & VbCrLf
    Body = Body & "ContactPhone: " & ContactPhone & VbCrLf
    Body = Body & "ContactEmail: " & ContactEmail & VbCrLf
    Body = Body & "ContactAddress: " & ContactAddress & VbCrLf
    Body = Body & "StudentsName: " & StudentsName & VbCrLf
    Body = Body & "YearofHighSchoolGraduation: " & YearofHighSchoolGraduation & VbCrLf
    Body = Body & "StudentsSATscores: " & StudentsSATscores & VbCrLf
    Body = Body & "StudentsGPA: " & StudentsGPA & VbCrLf
    Body = Body & "PleasetypeallthatapplyIaminterestedinAlltypesoffinancialaidscholarshipsAthleticscholarshipsonlySkilldevelopmentforbaseballonly: " & PleasetypeallthatapplyIaminterestedinAlltypesoffinancialaidscholarshipsAthleticscholarshipsonlySkilldevelopmentforbaseballonly & VbCrLf
    Body = Body & "PleasetypeallthatapplyCollegepreferencesInstateOutofstatePublicPrivate: " & PleasetypeallthatapplyCollegepreferencesInstateOutofstatePublicPrivate & VbCrLf

    ' send email
    Dim mail
    Set mail = Server.CreateObject("CDONTS.NewMail")
    mail.To = EmailTo
    mail.From = EmailFrom
    mail.Subject = Subject
    mail.Body = Body
    mail.Send

    ' redirect to success page
    Response.Redirect("thank you.html?" & EmailFrom)
    %>
     
    Ellablue, Feb 26, 2008 IP
  2. Free Born John

    Free Born John Guest

    Messages:
    111
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #2
    try setting emailfrom to a valid email address
     
    Free Born John, Feb 26, 2008 IP
  3. Ellablue

    Ellablue Peon

    Messages:
    9
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I'm confused...why? I don't know who the "emailfrom" is from until I get the form in my box. Are you talking about the response.redirect area after the thank you.html?
    Thank you~
     
    Ellablue, Feb 27, 2008 IP
  4. Free Born John

    Free Born John Guest

    Messages:
    111
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #4
    hi Ella

    the email is from you, sent via the smtp stack on your web server. You need to set mail.from to or something like that. The email address the user entered will be included in the email body.
     
    Free Born John, Feb 27, 2008 IP
  5. Ellablue

    Ellablue Peon

    Messages:
    9
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Freeborn,
    Yes! Thank you! It's finally working!!! I have only one more problem and it's with the submitted email. I'll post it in the asp again, since that's what's coming through.

    Thank you again!!
     
    Ellablue, Feb 27, 2008 IP