Visualizzazione dei risultati da 1 a 3 su 3
  1. #1
    Utente di HTML.it
    Registrato dal
    Mar 2001
    Messaggi
    131

    Problema con form che invia mail

    Ciao a tutti,
    ho un problema con un form php che invia una mail.

    Se imposto come un indirizzo di ricezione gmail o tiscali ricevo.
    Qualcuno sa aiutarmi???
    Non ricevo la mail invece su tin.it

    Il codice della pagina è il seguente:
    <html>
    <head>
    <link href="css/style.css" rel="stylesheet" type="text/css">
    <title>Richiesta informazioni</title></head>
    <body>
    <div class="logo2"> [img]img/lamadonnina.gif[/img] </div>
    <div class="richiesta">Richiesta informazioni</div>
    <div class="form">
    <?
    // CSS classes & styles
    $class_txt = "font:normal 13px Helvetica, Arial, SansSerif;";
    $class_inputbutton = "inputButton";
    $class_inputline = "inputLine";
    $class_inputfield = "inputField";
    $style_inputline = "width:305px;";
    $style_inputfield = "width:305px;";

    // email
    $target_address = "non funziona se metto un indirizzo email tin.it";
    $email_subject = "Richiesta informazioni dal sito web ";

    // error messages
    $err_name = "Per favore inserisci il nome.";
    $err_surname = "Per favore inserisci il cognome.";
    $err_evento = "Per favore inserisci il tipo di evento.";
    $err_tipologia = "Per favore inserisci il tipo di servizio richiesto (pranzo, cena).";
    $err_dateprev = "Per favore inserisci la data dell'evento.";
    $err_persone = "Per favore inserisci il numero di ospiti previsti.";
    $err_phone = "Per favore inserisci il numero di telefono.";
    $err_msg = "Per favore inserisci la richiesta.";
    $err_email = "Per favore inserisci un indirizzo email valido.";

    // misc text - modificare il testo rosso per i parametri sul sito
    $msg_date = "Data invio";
    $msg_name = "Nome";
    $msg_surname = "Cognome";
    $msg_company = "Società";
    $msg_evento = "Evento (matrimonio, coffee break)";
    $msg_tipologia = "Tipologia (pranzo, cena)";
    $msg_location = "Location";
    $msg_dateprev = "Data";
    $msg_persone = "N. ospiti previsti";
    $msg_phone = "Telefono";
    $msg_fax = "Fax";
    $msg_email = "Email";
    $msg_contatto = "Come preferite essere contattati (e-mail, fax, telefono)";
    /*$msg_consenso = "Consenso";*/
    /*$msg_answerby = "Reply by";*/
    $txt_email = "Email";
    $txt_phone = "Telefono";
    $txt_post = "Post";
    $txt_send = "Invia";
    $txt_mandatory = "campi obbligatori";
    $msg_request = "Richiesta informazioni";
    $msg_indent = 11;

    // messages
    $txt_thankyou = "<div style='position:absolute; left:0px; top:50px; width:350px; height:60px; z-index:1; color: #000000' class='testo3'>Grazie per averci contattato!
    Le risponderemo al più presto.</div>";
    $txt_error = "<div style='position:absolute; padding:10px; left:250px; top:0px; width:400px; height:300px; z-index:1; font:bold 14px Helvetica, Arial, SansSerif;color: #fff; background: #ff0000;'>Per inviare la richiesta è necessario:
    {errors}

    Torna al form</div>"; // {errors} is replaced by the errors that occurred



    function spaces($num, $fill=" "){
    $foo="";
    for ($i=0; $i<$num; $i++) $foo.=$fill;
    return $foo;
    }

    function isValidEmail($addr){
    if(eregi("^[a-z0-9]+([_.-][a-z0-9]+)*@([a-z0-9]+([.-][a-z0-9]+)*)+\\.[a-z]{2,4}$", $addr))
    return true;
    else
    return false;
    }


    // start form evaluation
    $error="foo";
    if ($_REQUEST['do']=="send"){
    $error=false;
    if ($_REQUEST['name']=="") $error.="&raquo; $err_name
    ";
    if ($_REQUEST['surname']=="") $error.="&raquo; $err_surname
    ";
    if ($_REQUEST['evento']=="") $error.="&raquo; $err_evento
    ";
    if ($_REQUEST['tipologia']=="") $error.="&raquo; $err_tipologia
    ";
    if ($_REQUEST['dateprev']=="") $error.="&raquo; $err_dateprev
    ";
    if ($_REQUEST['persone']=="") $error.="&raquo; $err_persone
    ";
    if ($_REQUEST['fon']=="") $error.="&raquo; $err_phone
    ";
    if ($_REQUEST['message']=="") $error.="&raquo; $err_msg
    ";
    if (!isValidEmail($_REQUEST['email'])) $error.="&raquo; $err_email
    ";
    if ($error===false){

    $message="$msg_date:".spaces($msg_indent-strlen($msg_date)).date("d M Y, H:i", time());
    if ($_REQUEST['name']) $message.="\n$msg_name:".spaces($msg_indent-strlen($msg_name)).$_REQUEST['name'];
    if ($_REQUEST['surname']) $message.="\n$msg_surname:".spaces($msg_indent-strlen($msg_surname)).$_REQUEST['surname'];
    if ($_REQUEST['company']) $message.="\n$msg_company:".spaces($msg_indent-strlen($msg_company)).$_REQUEST['company'];
    if ($_REQUEST['evento']) $message.="\n$msg_evento:".spaces($msg_indent-strlen($msg_evento)).$_REQUEST['evento'];
    if ($_REQUEST['tipologia']) $message.="\n$msg_tipologia:".spaces($msg_indent-strlen($msg_tipologia)).$_REQUEST['tipologia'];
    if ($_REQUEST['location']) $message.="\n$msg_location:".spaces($msg_indent-strlen($msg_location)).$_REQUEST['location'];
    if ($_REQUEST['dateprev']) $message.="\n$msg_dateprev:".spaces($msg_indent-strlen($msg_dateprev)).$_REQUEST['dateprev'];
    if ($_REQUEST['persone']) $message.="\n$msg_persone:".spaces($msg_indent-strlen($msg_persone)).$_REQUEST['persone'];
    if ($_REQUEST['fon']) $message.="\n$msg_phone:".spaces($msg_indent-strlen($msg_phone)).$_REQUEST['fon'];
    if ($_REQUEST['fax']) $message.="\n$msg_fax:".spaces($msg_indent-strlen($msg_fax)).$_REQUEST['fax'];
    if ($_REQUEST['contatto']) $message.="\n$msg_contatto:".spaces($msg_indent-strlen($msg_contatto)).$_REQUEST['contatto'];
    $message.="\n$msg_email:".spaces($msg_indent-strlen($msg_email))."mailto:".$_REQUEST['email'];
    /* eliminazione risposta come
    $message.="\n\n".spaces(strlen("$msg_answerby ".$_REQUEST['kontakt'])+1, "=");
    $message.="\n$msg_answerby ".$_REQUEST['kontakt']."!\n";
    $message.=spaces(strlen("$msg_answerby ".$_REQUEST['kontakt'])+1, "="); */
    $message.="\n\n$msg_request:\n\n".$_REQUEST['message'];

    mail($target_address, $email_subject, $message, "From: ".$_REQUEST['email']);
    echo $txt_thankyou;

    }else if ($error!==false) $error=str_replace("{errors}", $error, $txt_error);

    }

    if ($error!==false){

    if($error!="foo") echo $error;

    // form
    echo "<script language='JavaScript' type='text/JavaScript'>\n";
    echo "window.onload = function(){ document.form1.name.focus(); }\n";
    echo "</script>\n";
    echo "<form name='form1' method='post' action=''>\n";
    echo "<table border='0' cellpadding='1' cellspacing='0' class='codform'>\n";
    echo "<tr><td></td>\n";
    echo "</td></tr>\n";
    echo "<tr><td width='250' class='testo3'>$msg_name*</td>\n";
    echo "<td height='30'><input name='name' type='text' class='$class_inputline' style='$style_inputline' value='".$_REQUEST['name']."'>\n";
    echo "</td></tr>\n";
    echo "<tr><td width='250' class='testo3'>$msg_surname*</td>\n";
    echo "<td height='30'><input name='surname' type='text' class='$class_inputline' style='$style_inputline' value='".$_REQUEST['surname']."'>\n";
    echo "</td></tr>\n";
    echo "<tr><td width='250' class='testo3'>$msg_company</td>\n";
    echo "<td height='30'><input name='company' id='company' type='text' class='$class_inputline' style='$style_inputline' value='".$_REQUEST['company']."'>\n";
    echo "</td></tr>\n";
    echo "<tr><td width='250' class='testo3'>$msg_evento*</td>\n";
    echo "<td height='30'><input name='evento' type='text' class='$class_inputline' style='$style_inputline' value='".$_REQUEST['evento']."'>\n";
    echo "</td></tr>\n";
    echo "<tr><td width='250' class='testo3'>$msg_tipologia*</td>\n";
    echo "<td height='30'><input name='tipologia' type='text' class='$class_inputline' style='$style_inputline' value='".$_REQUEST['tipologia']."'>\n";
    echo "</td></tr>\n";
    echo "<tr><td width='250' class='testo3'>$msg_location</td>\n";
    echo "<td height='30'><input name='location' type='text' class='$class_inputline' style='$style_inputline' value='".$_REQUEST['location']."'>\n";
    echo "</td></tr>\n";
    echo "<tr><td width='250' class='testo3'>$msg_dateprev*</td>\n";
    echo "<td height='30'><input name='dateprev' type='text' class='$class_inputline' style='$style_inputline' value='".$_REQUEST['dateprev']."'>\n";
    echo "</td></tr>\n";
    echo "<tr><td width='250' class='testo3'>$msg_persone*</td>\n";
    echo "<td height='30'><input name='persone' type='text' class='$class_inputline' style='$style_inputline' value='".$_REQUEST['persone']."'>\n";

    echo "</td></tr>\n";
    echo "<tr><td width='250' class='testo3'>$msg_phone*</td>\n";
    echo "<td height='30'><input name='fon' type='text' class='$class_inputline' style='$style_inputline' value='".$_REQUEST['fon']."'>\n";
    echo "</td></tr>\n";
    echo "<tr><td width='250' class='testo3'>$msg_fax</td>\n";
    echo "<td height='30'><input name='fax' type='text' class='$class_inputline' style='$style_inputline' value='".$_REQUEST['fax']."'>\n";
    echo "</td></tr>\n";
    echo "<tr><td width='250' class='testo3'>$msg_email*</td>\n";
    echo "<td height='30'><input name='email' type='text' class='$class_inputline' style='$style_inputline' value='".$_REQUEST['email']."'>\n";
    echo "</td></tr>\n";
    echo "<tr><td width='250' class='testo3'>$msg_contatto</td>\n";
    echo "<td height='30'><input name='contatto' type='text' class='$class_inputline' style='$style_inputline' value='".$_REQUEST['contatto']."'>\n";
    echo "</td></tr>\n";
    /*echo "<tr><td width='250' class='testo3'>$msg_answerby*</td>\n";
    echo "<td height='30' class='testo3'><input name='kontakt' type='radio' value='$txt_email' checked> $txt_email\n";
    echo "<input name='kontakt' type='radio' value='$txt_phone'> $txt_phone\n";
    echo "<input name='kontakt' type='radio' value='$txt_post'> $txt_post\n";
    echo "</td></tr>\n"; */
    echo "<tr><td width='250' class='testo3'>$msg_request*</td>\n";
    echo "<td height='30'><textarea name='message' cols='45'style='$style_inputfield' rows='10' class='$class_inputfield'>".$_REQUEST['message']."</textarea></td></tr>\n";
    echo "<tr><td width='250' ></td>\n";
    echo "<td height='30' class='testo3'>* $txt_mandatory</td></tr>\n";
    echo "<tr><td width='250' class='testo3'></td>\n";
    echo "<td height='30' class='pry'>
    Con l'invio del modulo si autorizza ...
    </td></tr>\n";
    /*echo "<tr><td width='250'></td>\n";
    echo "<td height='30' class'pry'><input name='consenso' type='radio' value='".$_REQUEST['consenso']."'>Do il onsenso\n";
    echo "</td></tr>\n";
    echo "<td height='30' class'pry'><input name='Acconsento' type='radio' value='Acconsento'>Do il consenso

    \n";*/
    echo "<tr><td width='250'></td>\n";
    echo "<td height='30' align='center'><input name='Submit' type='Submit' class='$class_inputbutton' value='$txt_send'>\n";
    echo "<input name='do' type='hidden' id='do' value='send'></td>\n";
    echo "</tr></table>\n";
    echo "</form>\n";

    }
    /*
    ######################### END Contact Form ##########################
    ################################################## ###################
    */
    ?>
    </div>
    </body>
    </html>

    degele

  2. #2
    1. Il codice andrebbe postato negli appositi tag
    2. Dubito che qualquno abbia voglia di leggere un codice così lungo
    3. Se gli email ti arrivano su gmail vuol dire che lo script funziona quindi il problema è altrove. Probabilmente tin te li calssifica come spam. Se hai una cartella spam controlla che non siano finiti li
    PHP LEARN - Guide, tutorial e articoli sempre aggiornati
    NUOVO: standardLib; il potente framework PHP é ora disponibile
    *******************************************
    Scarica oggi la tua copia di MtxEventManager

  3. #3
    Utente di HTML.it
    Registrato dal
    Mar 2001
    Messaggi
    131
    Grazie per la risposta!

    Ho già verificato se arrivano sulla cartella spam ma non ci sono, non arrivano proprio.

    Spero che anche se il codice è lungo qualcuno lo legga lo stesso.
    Come faccio ad impostare il codice negli appositi tag?

    Non può essere un problema del server tin?

    Grazie comunque!
    degele

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.