Visualizzazione dei risultati da 1 a 4 su 4

Discussione: problema form email

  1. #1

    problema form email

    SAlve a tutti, vorrei elencare 2 problemi... ho qst 2 funzioni nella pagina users.php per la gestione delll'invio email a gli iscritti su mio sito.. ora avrei necessita di 2 cose....

    1. che l'email oltre che all'utente venga inviata sempre anche al mio indirizzo email in modo da averle archiviate...
    mettendo
    $to = $email;
    $to = "mio indirizzo";

    invia solo al mio indirizzo

    2. ho un problema con i caratteri speciali.. ogni volta che scrivo nel form di testo me li cambia tutti come posos fare??


    Codice PHP:
    function SendEmail(){
             include(
    "header.php");
             global 
    $db$prefix$email$username$site_name$site_email$site_url;
             
             
    nav_menu();
             
             echo 
    "<form method=\"POST\" action=\"users.php\">
                   <table align=\"center\" border=\"0\" width=\"500\" cellpadding=\"2\">
            <tr>
                <td colspan=\"2\" align=\"center\">Spedisci email a (
    $username)</td>
            </tr>
            <tr>
                <td width=\"100\">To:</td>
                <td><input type=\"text\" name=\"email\" size=\"27\" value=\"
    $email\"></td>
                </tr>
                <tr>
                <td>Oggetto:</td>
                <td><input type=\"text\" name=\"subject\" size=\"27\" value=\"\"></td>
            </tr>
            <tr>
                <td valign=\"top\">Messaggio:</td>
                <td>Salve 
    $username,

                                <textarea rows=\"20\" name=\"msg\" cols=\"80\">Testoooo
    </textarea>
                                

                                ---------------------
                                

                                
    $site_name

                                
    $site_url
                                
                            </td>
            </tr>
            <tr>
                <td></td>
                <td><input type=\"hidden\" name=\"action\" value=\"do_SendEmail\">
                                <input type=\"submit\" value=\"INVIA\"></td>
            </tr>
         </table>"
    ;
             
             include(
    "footer.php");
    }
    function 
    do_SendEmail(){
             global 
    $email$username$subject$msg$site_name$site_email$site_url;

             
    $message "Salve $username,\n\n";
             
    $message .= "$msg\n\n\n\n";
             
    $message .= "-----------------------\n";
             
    $message .= "$site_name\n";
             
    $message .= "$site_url\n";
             
             
    $to $email;
         
    $to "mio indirizzo";
             
    $header "From: $site_name <$site_email>\n";
             
    $header .= "Reply-To: $site_email\n\n";

             if(
    mail($to$subject$message$header)){

                    
    msg_redirect("".LOGIN." ".EFFETTUATO." ".CON." ".SUCCESSO."","users.php","5");

             }else{
                   echo 
    "<h3>"
                        
    ."<font color=\"#FF0000\">An error occurred while sending the email.
    "
                        
    ."</font>You can try:
    "
                        
    ."1- Check the email is correct.
    "
                        
    ."2- Call your hosting provider to allow the function mail(); to send E-mails.
    "
                        
    ."3- If your running the script on localhost (on your pc) you have to:
    "
                        
    ."a: edit php.ini file. Click on (Start) menu then chose (Run) type in (php.ini) and hit Enter.
    "
                        
    ."b: Look for: 
    "
                        
    ."------------------
    "
                        
    ."[mail function]
    "
                        
    ."; For Win32 only.
    "
                        
    ."SMTP = localhost
    "
                        
    ."-------------------
    "
                        
    ."replace with:
    "
                        
    ."-------------------
    "
                        
    ."[mail function]
    "
                        
    ."; For Win32 only.
    "
                        
    ."SMTP = mail.palnet.com
    "
                        
    ."SMTP_PORT = 25
    "
                        
    ."-------------------
    "
                        
    ."you can change mail.palnet.com to any local email provide. we just need there mail server";
             }



  2. #2
    1.E' sufficiente utilizzare due volte la funzione mail(), una per l'email all'utente, una per la tua:
    Codice PHP:
    function SendEmail(){ 
             include(
    "header.php"); 
             global 
    $db$prefix$email$username$site_name$site_email$site_url
              
             
    nav_menu(); 
              
             echo 
    "<form method=\"POST\" action=\"users.php\"> 
                   <table align=\"center\" border=\"0\" width=\"500\" cellpadding=\"2\"> 
            <tr> 
                <td colspan=\"2\" align=\"center\">Spedisci email a (
    $username)</td> 
            </tr> 
            <tr> 
                <td width=\"100\">To:</td> 
                <td><input type=\"text\" name=\"email\" size=\"27\" value=\"
    $email\"></td> 
                </tr> 
                <tr> 
                <td>Oggetto:</td> 
                <td><input type=\"text\" name=\"subject\" size=\"27\" value=\"\"></td> 
            </tr> 
            <tr> 
                <td valign=\"top\">Messaggio:</td> 
                <td>Salve 
    $username,
     
                                <textarea rows=\"20\" name=\"msg\" cols=\"80\">Testoooo 
    </textarea> 
                                
     
                                --------------------- 
                                
     
                                
    $site_name
     
                                
    $site_url 
                                 
                            </td> 
            </tr> 
            <tr> 
                <td></td> 
                <td><input type=\"hidden\" name=\"action\" value=\"do_SendEmail\"> 
                                <input type=\"submit\" value=\"INVIA\"></td> 
            </tr> 
         </table>"

              
             include(
    "footer.php"); 

    function 
    do_SendEmail(){ 
             global 
    $email$username$subject$msg$site_name$site_email$site_url

             
    $message "Salve $username,\n\n"
             
    $message .= "$msg\n\n\n\n"
             
    $message .= "-----------------------\n"
             
    $message .= "$site_name\n"
             
    $message .= "$site_url\n"
              
             
    $to $email;
             
    $header "From: $site_name <$site_email>\n"
             
    $header .= "Reply-To: $site_email\n\n"
             
    $mailallutente mail($to$subject$message$header);
             
    $to "mio indirizzo"
             
    $mailame mail($to$subject$message$header);
             if(
    $mailallutente&&$mailame)){ 

                    
    msg_redirect("".LOGIN." ".EFFETTUATO." ".CON." ".SUCCESSO."","users.php","5"); 

             }else{ 
                   echo 
    "<h3>" 
                        
    ."<font color=\"#FF0000\">An error occurred while sending the email.

                        
    ."</font>You can try:

                        
    ."1- Check the email is correct.

                        
    ."2- Call your hosting provider to allow the function mail(); to send E-mails.

                        
    ."3- If your running the script on localhost (on your pc) you have to:

                        
    ."a: edit php.ini file. Click on (Start) menu then chose (Run) type in (php.ini) and hit Enter.

                        
    ."b: Look for: 

                        
    ."------------------

                        
    ."[mail function]

                        
    ."; For Win32 only.

                        
    ."SMTP = localhost

                        
    ."-------------------

                        
    ."replace with:

                        
    ."-------------------

                        
    ."[mail function]

                        
    ."; For Win32 only.

                        
    ."SMTP = mail.palnet.com

                        
    ."SMTP_PORT = 25

                        
    ."-------------------

                        
    ."you can change mail.palnet.com to any local email provide. we just need there mail server"
             } 


    2.temo che non che dipenda dalla codifica della mail, comunque, a mio parere, la cosa migliore è utilizzare una mail in html, che può contenere qualsiasi carattere speciale. Per fare ciò, è sufficiente specificarlo negli header della mail:

    Codice PHP:
    function SendEmail(){ 
             include(
    "header.php"); 
             global 
    $db$prefix$email$username$site_name$site_email$site_url
              
             
    nav_menu(); 
              
             echo 
    "<form method=\"POST\" action=\"users.php\"> 
                   <table align=\"center\" border=\"0\" width=\"500\" cellpadding=\"2\"> 
            <tr> 
                <td colspan=\"2\" align=\"center\">Spedisci email a (
    $username)</td> 
            </tr> 
            <tr> 
                <td width=\"100\">To:</td> 
                <td><input type=\"text\" name=\"email\" size=\"27\" value=\"
    $email\"></td> 
                </tr> 
                <tr> 
                <td>Oggetto:</td> 
                <td><input type=\"text\" name=\"subject\" size=\"27\" value=\"\"></td> 
            </tr> 
            <tr> 
                <td valign=\"top\">Messaggio:</td> 
                <td>Salve 
    $username,
     
                                <textarea rows=\"20\" name=\"msg\" cols=\"80\">Testoooo 
    </textarea> 
                                
     
                                --------------------- 
                                
     
                                
    $site_name
     
                                
    $site_url 
                                 
                            </td> 
            </tr> 
            <tr> 
                <td></td> 
                <td><input type=\"hidden\" name=\"action\" value=\"do_SendEmail\"> 
                                <input type=\"submit\" value=\"INVIA\"></td> 
            </tr> 
         </table>"

              
             include(
    "footer.php"); 

    function 
    do_SendEmail(){ 
             global 
    $email$username$subject$msg$site_name$site_email$site_url

             
    $message "Salve $username,\n\n"
             
    $message .= "$msg\n\n\n\n"
             
    $message .= "-----------------------\n"
             
    $message .= "$site_name\n"
             
    $message .= "$site_url\n"
              
             
    $to $email;
             
    $header "From: $site_name <$site_email>\r\n"
             
    $header .= "Reply-To: $site_email\r\n";
             
    $header .= 'Content-type: text/html; charset=iso-8859-1' "\r\n";
             
    $mailallutente mail($to$subject$message$header);
             
    $to "mio indirizzo"
             
    $mailame mail($to$subject$message$header);
             if(
    $mailallutente&&$mailame)){ 

                    
    msg_redirect("".LOGIN." ".EFFETTUATO." ".CON." ".SUCCESSO."","users.php","5"); 

             }else{ 
                   echo 
    "<h3>" 
                        
    ."<font color=\"#FF0000\">An error occurred while sending the email.

                        
    ."</font>You can try:

                        
    ."1- Check the email is correct.

                        
    ."2- Call your hosting provider to allow the function mail(); to send E-mails.

                        
    ."3- If your running the script on localhost (on your pc) you have to:

                        
    ."a: edit php.ini file. Click on (Start) menu then chose (Run) type in (php.ini) and hit Enter.

                        
    ."b: Look for: 

                        
    ."------------------

                        
    ."[mail function]

                        
    ."; For Win32 only.

                        
    ."SMTP = localhost

                        
    ."-------------------

                        
    ."replace with:

                        
    ."-------------------

                        
    ."[mail function]

                        
    ."; For Win32 only.

                        
    ."SMTP = mail.palnet.com

                        
    ."SMTP_PORT = 25

                        
    ."-------------------

                        
    ."you can change mail.palnet.com to any local email provide. we just need there mail server"
             } 


    Spero di esserti stato utile!

  3. #3
    ok grazie mille... ora provo non ho solo capito cosa hai cambiato per i caratteri speciali

  4. #4
    ah niente ok trovato... ora provo

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.