Pagina 1 di 2 1 2 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 11

Discussione: Form mail non funziona

  1. #1
    Utente di HTML.it L'avatar di bANART
    Registrato dal
    Jul 2005
    Messaggi
    662

    Form mail non funziona

    Ok, ora sono veramente disperato e avvilito e così chiedo a chi può spiegarmi PERCHè CACCHIO NON MI FUNZIONA NEANCHE UN FORM MAIL PHP????

    Ne ho provati una decina, ho un host xyz/Linux... (uff...)

    L'ultimo è questo:
    http://php.html.it/script/vedi/4966/basic-php-form/

    Aiuto!!
    Matteo Coletta - fotografia
    Fotografo Lanciano - Fotografia a Lanciano e Pescara

  2. #2
    Utente di HTML.it L'avatar di bANART
    Registrato dal
    Jul 2005
    Messaggi
    662
    Rettifica:

    Ora ho provato un form mail che mi propone proprio xyz:
    http://vademecum.xyz.it/start/contatto/formailPhp/formailPhpMultiplo.asp] http://vademecum.xyz.it/start/contatto/formailPhp/formailPhpMultiplo.asp[/URL]

    Se il form è compilato bene di "prima" (senza errori) arriva a destinazione.
    Se invece si fa un errore, si torna indietro, si corregge e si preme invia il form dice che è stato inviato, ma invece non arriva niente...

    Sapreste dirmi che cosa c'è che non va?

    Grassssssssssie!!
    Matteo Coletta - fotografia
    Fotografo Lanciano - Fotografia a Lanciano e Pescara

  3. #3
    Utente di HTML.it L'avatar di bANART
    Registrato dal
    Jul 2005
    Messaggi
    662
    Daaaaaiii.... possibile che nessuno sappia il motivo per cui non mi funziona neanche un form mail che ho provato?

    Matteo Coletta - fotografia
    Fotografo Lanciano - Fotografia a Lanciano e Pescara

  4. #4
    Posta il codice della pagina dove viene inviata la mail e forse ti possiamo dire qualcosa in più...
    --Cosimo
    MAIL: cosimo.g18@gmail.com

  5. #5

    Re: Form mail non funziona

    Ciao,

    parlare di hosters o nominarli è vietato dal regolamento, per questa volta censuro il nome e lascio aperto il thread ma fa più attenzione pls.
    The fastest Redis alternative ... cachegrand! https://github.com/danielealbano/cachegrand

  6. #6
    Utente di HTML.it L'avatar di bANART
    Registrato dal
    Jul 2005
    Messaggi
    662
    CIAOOO!!!!!

    Allora, mi piacerebbe utilizzare il form che ho linkato al primo messaggio... mi sembra molto buono.

    Il codice di "conferma" è il seguente:

    Codice PHP:
    <?php 

    /*
        This file is a part of Basic PHP Form.  Copyright (c) 2005 Mark MacCollin, Mevin Productions, [url]www.mevin.com[/url]

        This program is free software; you can redistribute it and/or modify
        it under the terms of the GNU General Public License as published by
        the Free Software Foundation; either version 2 of the License, or
        (at your option) any later version.

        This program is distributed in the hope that it will be useful,
        but WITHOUT ANY WARRANTY; without even the implied warranty of
        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
        GNU General Public License for more details.

        You should have received a copy of the GNU General Public License
        along with this program; if not, write to the Free Software
        Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    */ 

    include('header.php'); 
    require(
    'config.php');

    ///////////// receives the form values //////////////////////
       
    $first_name $_REQUEST['first_name'] ;
       
    $last_name $_REQUEST['last_name'] ;
       
    $home_address $_REQUEST['home_address'] ;
       
    $city $_REQUEST['city'] ;
       
    $state $_REQUEST['state'] ;
       
    $phone $_REQUEST['phone'] ;
       
    $zip $_REQUEST['zip'] ;
       
    $alt_phone $_REQUEST['alt_phone'] ;
       
    $email $_REQUEST['email'] ;
       
    $comments $_REQUEST['comments'] ;
    /////////////Allows the use of Apostrophes or single quotes /////////////////
       
    $comments=stripslashes($comments);
       

     
     
      
    ////////// makes sure the form is submitted from your server and not someone elses /////////////////////////
      
      
    if (strpos($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST'])>|| !strpos($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST']))
            die(
    "<font color=red>Error! Bad Referer</span> ");
             

    /////////////// Error messages.  ///////////////

    ///////// The first name through the state fields are only checked to ensure they aren't blank /////



      
    if (($first_name_on == "1" ) && ($first_name == ""))
      { echo 
    "<font color=red>First name is required.  Please go back and correct.</span>

    "
    ;

      }
        if ( 
    $last_name == "")
      { echo 
    "<font color=red>Last name is required.  Please go back and correct.</span>

    "
    ;

      }
      
       if ( 
    $city == "")
      { echo 
    "<font color=red>City is required.  Please go back and correct.</span>

    "
    ;

      }
      
       if ( 
    $state == "")
      { echo 
    "<font color=red>State is required.  Please go back and correct.</span>

    "
    ;

      }
      
      
    //////////////////// this error message verifies that the email field is typed in a valid email format. ////////////////
      
       
    if (!preg_match('/^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/',$email)) 
      { echo 
    "<font color=red>A valid email address is required. Please go back and correct.</span>

    "
    ;

      }
      
    ////// This error message verifies that the zip field is typed with either a 5 digit and/or with additional 4 digit code.  /////
     
        
    if (!preg_match('/^\d{5}(-\d{4})?$/',$zip)) 
    {
        echo(
    '<font color=red>A valid zip code is required. Please go back and correct.</span>

    '
    );

    }

    ////// This error message verifies that the phone field is typed with either the (###) ###-#### or the ###-###-#### format.

        
    if (!preg_match('/^\(?\d{3}\)?\s|-\d{3}-\d{4}$/',$phone)) 

      { echo 
    "<font color=red>A valid phone number is required. Please go back and correct.</span>

    "
    ;

      }
      
    $validation_error = (($first_name_on =="1") && ($first_name == ""))||(($last_name_on =="1") && ($last_name == ""))||(($city_on =="1") &&($city == ""))||(($state_on =="1") && ($state == ""))||(($email_on =="1") && (!preg_match('/^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/',$email)))||(($zip_on =="1") &&(!preg_match('/^\d{5}(-\d{4})?$/',$zip)))||(($phone_on =="1") && (!preg_match('/^\(?\d{3}\)?\s|-\d{3}-\d{4}$/',$phone)));

     
     if (
    $validation_error)
    {  
    echo
    "


    </p>
    <FORM><INPUT TYPE=\"button\" VALUE=\"Back\" onClick=\"history.go(-1)\"></FORM>


    </p>"
    ;

    include(
    'footer.php');
     exit();
     }

    //////// encapsulates all these variables in one to make it easier to pass on to the mail script /////////
    $msgbody =
    "
    First name:             
    $first_name
    Last name:              
    $last_name
    Home address:           
    $home_address
    City:                   
    $city
    State:                  
    $state
    Zip:                    
    $zip
    Primary phone:          
    $phone
    Alternate phone:        
    $alt_phone
    Email:                  
    $email

    Additional comments:    

    $comments"

    /////////////Allows the use of Apostrophes or single quotes /////////////////
       
    $msgbody=stripslashes($msgbody);


    ///////// prints the form results so the visitor can review. This option can be turned off in config.php.

    if ($confirm_option == "1")
    {
    print 
    "
    <table  border=0 class=confirm_table>
    <tr valign=top>
        <td colspan=2 align= ><div align=left>
        

    [b]<FONT class=almost_done>YOU'RE ALMOST DONE!</FONT> Here is what you submitted.  If this looks ok, click the [b]confirm[/b] button below.  If you need to make a correction, <a href=javascript:history.back(1)>click here to go back to the form.</a>[/b] </p>

        </td>
      </tr>
      <tr valign=top>
        <td align=right class=labels ><div align=left>First Name:</div></td>
        <td class=results><span class=results>
    $first_name</span>[/b]
        </td>
      </tr>
      <tr valign=top>
        <td class=labels ><div align=left>Last Name: </div></td>
        <td class=results ><span class=results>
    $last_name</span>[/b]</td>
      </tr>
      <tr valign=top>
        <td class=labels ><div align=left>Home Address: </div>
        </td>
        <td class=results ><span class=results>
    $home_address</span>[/b]</td>
      </tr>
      <tr valign=top>
        <td class=labels ><div align=left>City:

             
            
        </div></td>
        <td class=results ><span class=results>
    $city</span>[/b]
        </td>
      </tr>
      <tr valign=top>
        <td class=labels ><div align=left>State:</div></td>
        <td class=results > <span class=results>
    $state</span>[/b]</td>
      </tr>
      <tr valign=top>
        <td class=labels ><div align=left>Zip:</div></td>
        <td class=results ><span class=results>
    $zip</span>[/b]</td>
      </tr>
      <tr valign=top>
        <td class=labels ><div align=left>Primary Phone:</div></td>
        <td class=results ><span class=results>
    $phone</span>[/b]</td>
      </tr>
      <tr valign=top>
        <td class=labels ><div align=left>Alternate Phone: </div></td>
        <td class=results ><span class=results>
    $alt_phone</span>[/b]</td>
      </tr>
      <tr valign=top>
        <td class=labels ><div align=left>E-mail:</div></td>
        <td class=results ><span class=results>
    $email</span>[/b]</td>
      </tr>
       <tr valign=top>
        <td colspan=2 valign=top ><div align=left>
          

    <span class=labels>Additional comments:</span>

            <span class=results>
    $comments</span>
     
            </p>
          </div></td>
      </tr>
      <tr valign=top>
        <td colspan=2></td>
      </tr>
    </table>




     
    <form action=\"mail.php\" method=\"post\">
    <table border=0>
    <tr><td>


    <input name=\"msgbody\" type=\"hidden\" value=\"
    $msgbody\">
    <input name=\"email\" type=\"hidden\" value=\"
    $email\">
    <input name=\"first_name\" type=\"hidden\" value=\"
    $first_name\">
    <input name=\"last_name\" type=\"hidden\" value=\"
    $last_name\">
    <center><input type=\"submit\" name=\"Submit\" value=\"Confirm\">
        </center>

    </td></tr>
    </table></form>
    "
    ;
    include(
    'footer.php');
     exit();

    else {
    print 
    "";

    }


    //////// encapsulates all these variables in one to make it easier to pass on to the mail script /////////
    $msgbody =
    "
    First name:             
    $first_name
    Last name:              
    $last_name
    Home address:           
    $home_address
    City:                   
    $city
    State:                  
    $state
    Zip:                    
    $zip
    Primary phone:          
    $phone
    Alternate phone:        
    $alt_phone
    Email:                  
    $email

    Additional comments:    

    $comments"

    /////////////Allows the use of Apostrophes or single quotes /////////////////
       
    $msgbody=stripslashes($msgbody);

    /* subject */
    $subject "$the_subject";

    /* Uncomment the code below if you're sending HTML mail */

    if ($html_on =="1")
    {
    $headers  "MIME-Version: 1.0\r\n";
    $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
    }
       
    $headers .= "To: $recipient_main\r\n";
    $headers .= "From: $first_name $last_name <$email>\r\n";
    $headers .= "Cc: $recipient_cc\r\n";
    $headers .= "Bcc: $recipient_bcc\r\n";

    /* and now mail it */
    mail($to$subject$msgbody$headers);

    /* Thank the visitor */

    print "$thanks";

    include(
    'footer.php'); ?>
    Poi c'è un file "config" che è il seguente...

    Codice PHP:
    <?php
    /*
        This file is a part of Basic PHP Form.  Copyright (c) 2005 Mark MacCollin, Mevin Productions, [url]www.mevin.com[/url]

        This program is free software; you can redistribute it and/or modify
        it under the terms of the GNU General Public License as published by
        the Free Software Foundation; either version 2 of the License, or
        (at your option) any later version.

        This program is distributed in the hope that it will be useful,
        but WITHOUT ANY WARRANTY; without even the implied warranty of
        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
        GNU General Public License for more details.

        You should have received a copy of the GNU General Public License
        along with this program; if not, write to the Free Software
        Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    */ 

    /*
    To make this program work, all you have to do is upload all the files to the same server directory and modify the variables below (where you want the results to be emailed)  If you need further help, see the readme document.
    */

    // This is the main email address where the form results are sent:
    $recipient_main="miamail@gmail.com";

    // CC
    $recipient_cc="";

    //BCC
    $recipient_bcc="";

    //Subject of incoming email
    $the_subject="Subjects are a good thing";

    //Choose which fields you want to make required by entering a 1 for yes and 0 for no.  This makes it easy to optionally validate any field.  NOTE: the validation for the phone number and zip code is configured for the United States. 
    $first_name_on="1";
    $last_name_on="1";
    $home_address_on="1";
    $city_on="1";
    $state_on="1";
    $zip_on="1";
    $phone_on="1";
    $email_on="1";
    $comments_on="1";

    //Allows the use of Apostrophes or single quotes - DO NOT edit this line!
    $comments=stripslashes($comments);

    //Allows the use of html mail.  1 for yes, 0 for no. (html mail is not recommended)
    $html_on="0";

    //Confirmation page option.  Choose 1 if you want a confirmation page and 0 if you want the form submitted right after the submit button is clicked.
    $confirm_option="1";

    // message to the visitor thanking them for filling out the form
    $thanks="<table class=confirm_table border=0>
    <tr valign=top>
        <td>

    [b]Thank You!  Have a great day![/b]</p>
        
        

    </p>
        

    </p>
        

    </p>
        </td></tr></table>
        "
    ;


    ?>

    Spero possiate essemi di aiuto, non capisco perchè non mi arrivano ste mail... uff... sarà mica gmail? ...Naaaaaa
    Sarà xyz? ...boo!?
    Matteo Coletta - fotografia
    Fotografo Lanciano - Fotografia a Lanciano e Pescara

  7. #7
    Ho provato lo script utilizzando il mio mailserver e come destinatario la mia mail personale e funziona.

    Molto probabilmente è colpa del tuo hoster.

    Saluti!
    --Cosimo
    MAIL: cosimo.g18@gmail.com

  8. #8
    Utente di HTML.it L'avatar di bANART
    Registrato dal
    Jul 2005
    Messaggi
    662
    Cos'è il mail server? ...devo settare qualcosa in particolare nello script?
    Oppure è colpa di xyz e non ci posso fare niente?
    Matteo Coletta - fotografia
    Fotografo Lanciano - Fotografia a Lanciano e Pescara

  9. #9
    "Un mail server (Mail Transfer Agent o MTA) è un programma, e per estensione il computer su cui viene eseguito, che si occupa dello smistamento da un computer a un altro della posta elettronica." da Wikipedia

    Prova a sentire dall'assistenza del tuo hoster...

    Ti ricordo le parole di daniele_dll:
    "Ciao,
    parlare di hosters o nominarli è vietato dal regolamento, per questa volta censuro il nome e lascio aperto il thread ma fa più attenzione pls."

    Saluti!
    --Cosimo
    MAIL: cosimo.g18@gmail.com

  10. #10
    Utente di HTML.it L'avatar di bANART
    Registrato dal
    Jul 2005
    Messaggi
    662
    Ops... chiedo scusa...

    Chiederò allora al mio hoster.

    Grazie 1000 Cosimo
    Matteo Coletta - fotografia
    Fotografo Lanciano - Fotografia a Lanciano e Pescara

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.