Visualizzazione dei risultati da 1 a 4 su 4

Discussione: Email Form

  1. #1

    Email Form

    Ciao a tutti espongo qui il mio problema nella speranza che qualcuno mi possa donare un po' di luce nel buoi cunicolo di asp dove mi sono ficcata ....Nel code asp in basso non riesco a capire perche' pur mandandomi dopo l'invio alla pagina dei ringraziamenti(thank_you.html)nn invia il contenuto del form al destinatario dell'email...Ho controllato tutti i campi e l'email e' sicuramente esatto...percio' non so proprio dove sbattere la testa ...Grazie in anticipo a chi mi rispondera'.
    <%
    'Set the response buffer to true so we execute all asp code before sending the HTML to the clients browser
    Response.Buffer = True

    'Dimension variables
    Dim strBody 'Holds the body of the e-mail
    Dim objCDOMail 'Holds the mail server object
    Dim strMyEmailAddress 'Holds your e-mail address
    Dim strCCEmailAddress 'Holds any carbon copy e-mail addresses if you want to send carbon copies of the e-mail
    Dim strBCCEmailAddress 'Holds any blind copy e-mail addresses if you wish to send blind copies of the e-mail
    Dim strReturnEmailAddress 'Holds the return e-mail address of the user


    '----------------- Place your e-mail address in the following sting ----------------------------------

    strMyEmailAddress = "waterpark@ntlworld.com"

    '----------- Place Carbon Copy e-mail address's in the following sting, separated by ; --------------

    strCCEmailAddress = "" 'Use this string only if you want to send the carbon copies of the e-mail

    '----------- Place Blind Copy e-mail address's in the following sting, separated by ; --------------

    strBCCEmailAddress = "" 'Use this string only if you want to send the blind copies of the e-mail

    'Read in the users e-mail address
    'strReturnEmailAddress = Request.Form("stremail")

    strReturnEmailAddress = "waterpark@ntlworld.com"

    'Initialse strBody string with the body of the e-mail
    strBody = "<font size='2' face='Verdana, Arial, Helvetica, sans-serif'>Cash For House : Contact Form E-mail
    "
    strBody = strBody & "
    Name: " & Request.Form("strtitle") & " " & Request.Form("strfname") & " " & Request.Form("strsname")
    'Conditional Statements for optional fields so that we don't get messy email with no fields filled in.
    If (Request.Form("straddr1")) > "" Then
    strBody = strBody & "

    Address: -
    " & Request.Form("straddr1")
    End If
    If (Request.Form("straddr2")) > "" Then
    strBody = strBody & "
    " & Request.Form("straddr2")
    End If
    If (Request.Form("strtown")) > "" Then
    strBody = strBody & "
    " & Request.Form("strtown")
    End If
    If (Request.Form("strcounty")) > "" Then
    strBody = strBody & "
    " & Request.Form("strcounty")
    End If
    If (Request.Form("strpcode")) > "" Then
    strBody = strBody & "
    " & Request.Form("strpcode") & "

    " & vbCrLf
    End If
    'If (Request.Form("chkNewsletter")) = "1" Then
    ' strBody = strBody & "
    " & "Newsletter:Yes, I would like to receive your regular e-mail newsletter." & vbCrLf
    ' Else
    ' strBody = strBody & "
    " & "Newsletter:No, I would not like to receive your regular e-mail newsletter." & vbCrLf
    'End If
    'Some Mandatory fields that do not require validation
    strBody = strBody & "Telephone:
    " & Request.Form("strtel") & "
    " & vbCrLf
    strBody = strBody & "
    E-mail:
    " & Request.Form("stremail")
    If (Request.Form("strAdd")) > "" Then
    strBody = strBody & "

    Address of property you wish to sell:
    " & Replace(Request.Form("strAdd"), vbCrLf, "
    </font>")
    End If
    If (Request.Form("strtype")) > "" Then
    strBody = strBody & "

    Type of property:
    " & Replace(Request.Form("strtype"), vbCrLf, "
    </font>")
    End If
    If (Request.Form("strPri")) > "" Then
    strBody = strBody & "

    Price of Similar property £:
    " & Replace(Request.Form("strPri"), vbCrLf, "
    </font>")
    End If
    If (Request.Form("strAge")) > "" Then
    strBody = strBody & "

    If up for sale, name of agent:
    " & Replace(Request.Form("strAge"), vbCrLf, "
    </font>")
    End If
    If (Request.Form("strBedroom")) > "" Then
    strBody = strBody & "

    Number of bedrooms:
    " & Replace(Request.Form("strBedroom"), vbCrLf, "
    </font>")
    End If

    If (Request.Form("chkOwn")) = "1" Then
    strBody = strBody & "

    Features: Own Drive" & "
    " & vbCrLf
    End If
    If (Request.Form("chkPar")) = "1" Then
    strBody = strBody & "Features: Parking" & "
    " & vbCrLf
    End If
    If (Request.Form("chkGar")) = "1" Then
    strBody = strBody & "Features: Garden" & "
    " & vbCrLf
    End If
    If (Request.Form("strTen")) > "" Then
    strBody = strBody & "
    Tenanted:
    " & Replace(Request.Form("strTen"), vbCrLf, "
    </font>")
    End If
    If (Request.Form("chkFre")) = "1" Then
    strBody = strBody & "

    Freehold" & "
    " & vbCrLf
    End If
    If (Request.Form("chkLea")) = "1" Then
    strBody = strBody & "

    Leasehold" & "
    " & vbCrLf
    End If
    If (Request.Form("strpc")) > "" Then
    strBody = strBody & "

    Condition:
    " & Replace(Request.Form("strpc"), vbCrLf, "
    </font>")
    End If
    If (Request.Form("strhow")) <> "Please select..." Then
    strBody = strBody & "

    How did you hear about Us?
    " & Request.Form("strhow") & "
    " & vbCrLf
    End If
    'Final Conditional Statement for Optional Comments field
    If (Request.Form("strcomments")) > "" Then
    strBody = strBody & "
    Further Information:
    " & Replace(Request.Form("strcomments"), vbCrLf, "
    </font>")
    End If

    'Check to see if the user has entered an e-mail address and that it is a valid address otherwise set the e-mail address to your own otherwise the e-mail will be rejected
    If Len(strReturnEmailAddress) < 5 OR NOT Instr(1, strReturnEmailAddress, " ") = 0 OR InStr(1, strReturnEmailAddress, "@", 1) < 2 OR InStrRev(strReturnEmailAddress, ".") < InStr(1, strReturnEmailAddress, "@", 1) Then
    'Set the return e-mail address to your own
    strReturnEmailAddress = strMyEmailAddress
    End If


    'Send the e-mail

    'Create the e-mail server object
    Set objCDOMail = Server.CreateObject("CDONTS.NewMail")

    'Who the e-mail is from (this needs to have an e-mail address in it for the e-mail to be sent)
    objCDOMail.From = Request.Form("strfname") & " " & Request.Form("strsname") & " <" & strReturnEmailAddress & ">"

    'Who the e-mail is sent to
    objCDOMail.To = strMyEmailAddress

    'Who the carbon copies are sent to
    objCDOMail.Cc = strCCEmailAddress

    'Who the blind copies are sent to
    objCDOMail.Bcc = strBCCEmailAddress

    'Set the subject of the e-mail
    objCDOMail.Subject = "Cash For House : Contact Form E-mail"

    'Set the e-mail body format (0=HTML 1=Text)
    objCDOMail.BodyFormat = 0

    'Set the mail format (0=MIME 1=Text)
    objCDOMail.MailFormat = 0

    'Set the main body of the e-mail
    objCDOMail.Body = strBody

    'Importance of the e-mail (0=Low, 1=Normal, 2=High)
    objCDOMail.Importance = 1

    'Send The E-mail

    objCDOMail.Send

    'response.write strResult


    'Close the server object
    Set objCDOMail = Nothing

    ' Redirect User to Thankyou Page
    Response.Redirect("thank_you.html")
    %>

  2. #2
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    Ma l'email non arriva proprio o è incompleta? Non ho capito.

    Roby

  3. #3
    I contenuti del forum non arrivano all'email specificata nel code, ma pare che l'asp viene eseguito perche' ridireziona alla pagina dei ringraziamenti per aver spedito il form. Ciao e grazie per aver risposto.

  4. #4
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    Prova a mettere un mittente della email esistente nel server smtp del dominio che spedisce.
    Cioè se il sito si chiama pippo.it l'email .FROM deve essere qualcosa tipo info@pippo.it non può essere l'email di chi compila il form.

    Roby

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2026 vBulletin Solutions, Inc. All rights reserved.