Visualizzazione dei risultati da 1 a 2 su 2

Discussione: invio mail con form

  1. #1
    Utente di HTML.it
    Registrato dal
    May 2005
    Messaggi
    142

    invio mail con form

    Ciao a tutti, allego una pagina di un form in asp per l'invio di alcuni dati ad un indirizzo mail, fino a qualche giorno fà questa pagina era su un server web che aveva sistema operativo windows server 2000, ora l'azienda che gestisce questo server web ha cambiato il sistema operaticvo con windows server 2003 e questa pagina non funziona più. mi dice che la mail è stata inoltrata ma se vado a controllare non arriva niente. devo far mettere qualche libreria nel server web?devo richiedera qualcosa a chi gestisce il server?
    questa è la pagina:

    <%@ Language = "VBScript" %>
    <%
    Select Case Request.Querystring("Action")
    Case "Send"

    on error resume next
    'Set variables
    Dim BackURL
    Dim strName
    Dim strEmail
    Dim strSubject
    Dim strMessage
    Dim strUserIP
    Dim strToEmail
    Dim daCdoMail
    Dim strPet
    Dim ArrivalMonth
    Dim Last
    Dim First
    Dim Address
    Dim City
    Dim Postcode
    Dim Country
    Dim Tel
    Dim Fax

    Dim Arrivaldate
    Dim Arrivalyear
    Dim DepartureMonth
    Dim Departuredate
    Dim Departureyear
    Dim Apartment

    'Replace this email with your real email id
    strToEmail = "luigibartolini@alice.it"
    BackURL = Request.ServerVariables("HTTP_REFERER")
    strName = Request.form("Name")
    strEmail = Request.form("Email")
    strSubject = Request.form("Subject")
    strPet = Request.form("Pet")
    strMessage = Request.form("Message")
    strUserIP = Request.ServerVariables("REMOTE_ADDR")
    ArrivalMonth = Request.form("ArrivalMonth")
    Last = Request.form("Last")
    First = Request.form("First")
    Address = Request.form("Address")
    City = Request.form("City")
    Postcode = Request.form("Postcode")
    Country = Request.form("Country")
    Tel = Request.form("Tel")
    Fax = Request.form("Fax")
    Arrivaldate = Request.form("Arrivaldate")
    Arrivalyear = Request.form("Arrivalyear")
    DepartureMonth = Request.form("DepartureMonth")
    Departuredate = Request.form("Departuredate")
    Departureyear = Request.form("Departureyear")
    Apartment = Request.form("Apartment")



    'Create Mail Object
    Set daCdoMail = CreateObject("CDONTS.NewMail")
    daCdoMail.To = strToEmail
    daCdoMail.From = strEmail
    daCdoMail.Subject = strSubject
    daCdoMail.Body = "<font size=""small"">This message was sent by

    name:" & Last & "
    Surname: " & First & "
    Address: " & Address & "
    City: " & City & "
    Postcode: " & Postcode & "
    Country: " & Country & "
    Tel: " & Tel & "
    Fax: " & Fax & "
    Arrival date: " & ArrivalMonth & " " & Arrivaldate & " " & Arrivalyear & "
    Departure date: " & DepartureMonth & " " & Departuredate & " " & Departureyear & "
    Apartment: " & Apartment & "
    at " & Now() & ". </font>

    " & strMessage & _
    "<hr height=""1""><font size=""2"">ASP Contact Form Script</font>
    " & _
    "http://www.xxxxxxxxx.com</font>"
    'You can change the mail body format setting below
    '0 = HTML, 1 = TEXT
    daCdoMail.BodyFormat = 0
    'You can change the mail format setting below
    '0 = HTML, 1 = TEXT
    daCdoMail.MailFormat = 0
    'Set Server Side Validation to make sure we got both sender and recipient email Id to send email
    If strToEmail = "" OR strEmail = "" Then
    Session("msg") = "Sender Email or Resipient Email is blank. This message can not be sent. Please try again"
    Response.redirect (BackURL)
    Else
    'Now send email to the address you specified at line no. 16
    daCdoMail.Send
    End If
    'Destroy mail object
    Set daCdoMail = Nothing

    'Create result text in a Sesion
    Session("MsgSent") = "Your email with subject [" & strSubject & "] has been sent. Thank you for writing to us."
    'Redirect and show the result
    Response.redirect (BackURL)
    End Select
    %>
    <html>

    <head>
    <meta http-equiv="Content-Language" content="en-us">
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <title></title>
    <meta name="Naing Win - DigitalArakan - http://www.digitalarakan.net" content="Author">
    <SCRIPT language=javascript>
    function check()
    {
    if (document.myform.Name.value.length==0)
    {
    alert("Please enter your Name");
    document.myform.Name.focus();
    }
    else if(document.myform.Email.value.length==0 || document.myform.Email.value.indexOf("@")==-1 || document.myform.Email.value.indexOf(".")==-1 || document.myform.Email.value.indexOf(" ")==0)
    {
    alert("You must enter a Valid Email ID")
    document.myform.Email.focus();
    }
    else if (document.myform.Subject[document.myform.Subject.selectedIndex].value.length==0)
    {
    alert("Please select a Subject");
    document.myform.Subject.focus();
    }
    else if(document.myform.Message.value==0)
    {
    alert("Message field cannot be left empty");
    document.myform.Message.focus();
    }

    else
    {
    document.myform.submit()
    }
    }
    </SCRIPT>
    <style>
    <!--
    h3 { font-family: Tahoma; font-size: 14pt; color: #003399; font-weight: bold }
    td { font-family: Tahoma; font-size: 11pt }
    body {
    background-color: #e7f1da;
    }
    a:link {
    color: #27686E;
    }
    a:visited {
    color: #27686E;
    }
    a:active {
    color: #27686E;
    }
    -->
    </style>
    </head>

    <body>
    <%If Session("msgSent") = "" Then%>
    <table cellSpacing="1" border="0" bordercolor="#111111" id="table1" width="100%">
    <form action="Contact.asp?Action=Send" method="post" name="myform">

    <tr>
    <td align="right" colspan="2">
    <h3 align="left"><u>Contact/Booking Form</u></h3> </td>
    </tr>
    <tr>
    <td colspan="2"><u>

    Please add: luigi.bartolni to your accepted email list and send a current telephone number, so that we may follow up on info requested. Thank you.</u></td>
    </tr>
    <%If Session("msg") <> "" Then%>
    <tr>
    <td colspan="2">
    <font size="1" color="#FF0000"><%=Session("msg")%></font></td>
    </tr>
    <%End If%>
    <tr>
    <td colspan="2"> </td>
    </tr>
    <tr>
    <td class="nortex">Last Name:</td>
    <td class="nortex">
    <input maxLength="25" size="37" name="Name" value="<%= Request.form("Name") %>"></td></tr>
    <tr>
    <tr>
    <td class="nortex">First Name:</td>
    <td class="nortex">
    <input maxLength="25" size="37" name="First" value="<%= Request.form("First") %>"></td></tr>
    <tr>
    <tr>
    <td class="nortex">Address:</td>
    <td class="nortex">
    <input maxLength="25" size="37" name="Address" value="<%= Request.form("Address") %>"></td></tr>
    <tr>
    <tr>
    <td class="nortex">City:</td>
    <td class="nortex">
    <input maxLength="25" size="37" name="City" value="<%= Request.form("City") %>"></td></tr>
    <tr>
    <tr>
    <td class="nortex">Post Code:</td>
    <td class="nortex">
    <input maxLength="25" size="37" name="Postcode" value="<%= Request.form("Postcode") %>"></td></tr>
    <tr>

    <td class="nortex">Your Email:</span></td>
    <td class="nortex">
    <input maxLength="50" size="37" name="Email" value="<%= Request.form("Email") %>"></td></tr>

    <tr>
    <td class="nortex">Country:</td>
    <td class="nortex"><select name="Country">
    <option value="Afghanistan">Afghanistan</option>
    <option value="Albania">Albania</option>
    <option value="Algeria">Algeria</option>
    <option value="American Samoa">American Samoa</option>
    <option value="Andorra">Andorra</option>
    <option value="Anguilla">Anguilla</option>
    <option value="Angola">Angola</option>
    <option value="Antarctica">Antarctica</option>
    <option value="Antigua and Barbuda">Antigua and Barbuda</option>
    <option value="Armenia">Armenia</option>
    <option value="Argentina">Argentina</option>


    </select></td>
    </tr>
    <tr>
    <td class="nortex">Subject:</td>
    <td class="nortex"><select name="Subject">
    <option selected>Select Subject</option>
    <option value="Reservation">Reservation</option>
    <option value="Wedding">Wedding</option>
    <option value="Self catering" links>Self catering</option>
    <option value="Question" of the above>Question</option>
    </select></td>
    </tr>
    <tr>
    <td class="nortex">Telephone number (City and Country Code):</td>
    <td class="nortex">
    <input maxLength="25" size="37" name="Tel" value="<%= Request.form("Tel") %>"></td></tr>
    <tr>
    <tr>
    <td class="nortex">Fax number (City and Country Code):</td>
    <td class="nortex">
    <input maxLength="25" size="37" name="Fax" value="<%= Request.form("Fax") %>"></td></tr>
    <tr>
    <tr>
    <td class="nortex">Arrival Date:</td>
    <td class="nortex"><select name="ArrivalMonth">
    <option selected>select month</option>
    <option>January</option>
    <option>February</option>
    <option>March</option>
    <option>April</option>

    </select>
    <select name="Arrivaldate">
    <option selected>select date</option>
    <option>1</option>
    <option>2</option>

    </select>
    <select name="Arrivalyear">
    <option selected>select year</option>
    <option value="2007">2007</option>
    <option value="2008">2008</option>
    <option value="2009">2009</option>
    <option value="2010">2010</option>
    </select>
    </td>
    </tr>
    <tr>
    <td class="nortex">Departure Date:</td>
    <td class="nortex"><select name="DepartureMonth">
    <option selected>select month</option>
    <option>January</option>
    <option>February</option>
    <option>March</option>
    <option>April</option>

    </select>
    <select name="Departuredate">
    <option selected>select date</option>
    <option>1</option>
    <option>2</option>
    <option>3</option>
    <option>4</option>
    <option>5</option>
    <option>6</option>
    <option>7</option>
    <option>8</option>

    </select>
    <select name="Departureyear">
    <option selected>select year</option>
    <option value="2007">2007</option>
    <option value="2008">2008</option>
    <option value="2009">2009</option>
    <option value="2010">2010</option>
    </select>
    </td>
    </tr>
    <tr>
    <td class="nortex">Apartment:</td>
    <td class="nortex"><select name="Apartment">
    <option>Please select an Apartment</option>
    <option value="Il Re">Il Re</option>
    <option value="La Regina">La Regina</option>
    <option value="Il Poggio">Il Paggio</option>
    <option value="Dieci">Dieci</option>
    <option value="Nove">Nove</option>
    <option value="Otto">Otto</option>
    <option value="Sette">Sette</option>
    </select></td>
    </tr>
    <tr>
    <td class="nortex" valign="top">How did you learn about?:</td>
    <td class="nortex">
    <textarea name="Message" rows="12" cols="48"><%= Request.form("Message") %></textarea></td></tr>
    <tr>
    <td class="nortex"></td>
    <td class="nortex">
    <input onClick="check()" type="button" value="Send Message" name="sendmessage" style="float: center; font-weight:bold"></td></tr>
    <tr>
    <td class="nortex" colspan="2"></td>
    </tr>
    <tr>
    <td class="nortex" colspan="2"></td>
    </tr>
    </form>
    </table>
    <%Else%>
    <table cellSpacing="1" border="0" bordercolor="#111111" id="table2" width="100%">


    <tr>
    <td align="right">
    <h3 align="left">Message Sent</h3>
    </td>
    </tr>
    <tr>
    <td>
    <font size="1" color="#FF0000"><%=Session("MsgSent")%></font></td>
    </tr>
    <tr>
    <td>


    </td></tr>
    </table>
    <%End If
    'Destroy session variables
    Session("MsgSent") = ""
    Session("msg") = ""
    %>
    </body>

    </html>

    ho tolto un pò di option value per far entrare tutto nel messaggio!!!

    help!!!!!

  2. #2
    Utente di HTML.it L'avatar di yro
    Registrato dal
    Sep 2003
    Messaggi
    2,916
    credo che devi cambiare l'oggetto CDONTS con CDOSYS.

    fai una ricerca vedrai che trovi tutto quello che ti serve!

    tiè beccate questo:

    codice:
    'invio email
    Dim MiaMail
    Set MiaMail = Server.CreateObject("CDO.Message")
    MiaMail.From = strEmailda
    MiaMail.To = strEmaila
    MiaMail.Cc = ""
    MiaMail.Bcc = ""
    MiaMail.Subject = (strTitolo)
    MiaMail.HTMLBody = strBody
    MiaMail.Fields("urn:schemas:httpmail:importance").Value = 2
    MiaMail.Fields.Update()
    MiaMail.Send()
    Set MiaMail = Nothing
    per eventuali altri problemi cè un 3d in rilievo specifico per i cambiamenti di server2003!
    E se avessi il dono della profezia e conoscessi tutti i misteri e tutta la scienza, e possedessi la pienezza della fede così da trasportare le montagne, ma non avessi la carità, non sono nulla.

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 © 2025 vBulletin Solutions, Inc. All rights reserved.