5160 sujets

Le Bar du forum

Bonjour,

J'utilise un formulaire d'envoi de mail tout simple dans mon site, sans BD ...

Je reçoit l’émail mais pas le contenu !!

voici le code HTML

<form id="main-contact-form" name="contact-form" action="sendemail.php" method="POST" role="form"><br>
 
                    <div class="col-md-4">
                        <div class="form-group">
                            <label class="form-label" for="name">Votre Nom</label>
                            <input type="text" class="form-control" id="name" name="name" placeholder="Votre Nom" maxlength="100" tabindex="1" required>
                        </div>                            
                    </div>
 
                    <div class="col-md-4">
                        <div class="form-group">
                            <label class="form-label" for="email">Votre Email</label>
                            <input type="email" class="form-control" id="email" name="email" placeholder="Votre Email" tabindex="2" required>
                        </div> 
                    </div>
 
                    <div class="col-md-4">                           
                        <div class="form-group">
                            <label class="form-label" for="subject">Objet</label>
                            <input type="text" class="form-control" id="subject" name="subject" placeholder="Objet" tabindex="3">
                        </div>                            
                    </div>
 
                    <div class="col-md-12">
                        <div class="form-group">
                            <label class="form-label" for="message">Message</label>
                            <textarea rows="5" cols="50" name="message" class="form-control" id="Message" placeholder="Message..." tabindex="4" required></textarea> 
                        </div>
                    </div>
 
                    <div class="col-md-12">
                        <div class="fileupload fileupload-new" data-provides="fileupload">
                            <span class="btn btn-primary btn-file"><span class="fileupload-new">Importer un fichier</span>
                            <span class="fileupload-exists">Changer</span>         
                                <input type="file" /></span>
                            <span class="fileupload-preview"></span>
                                <a class="close fileupload-exists" data-dismiss="fileupload" style="float: none">X</a> 
                        </div> 
                        <div class="text-center">
                            <button type="submit" class="btn btn-start-order">Envoyer</button>
                        </div>
                    </div>
                </form>


Et le code PHP

<?php 


   // formulaire envoyé, on récupère tous les champs.
      $nom =$_POST['nom'];
      $sujet=$_POST['sujet'];
      $email=$_POST['email'];
      $msg=$_POST["message"];
      $to="hedi.chkir@adexa-hospitality.com";
   

    //Corps du mail en commençant par le message principal
      setlocale (LC_TIME, 'fr_FR');
      $mail_corps =  "Envoyé "." par $nom\r\n";
      $mail_corps .= "\r\n";    
      $mail_corps .="Sujet : $sujet\r\n";
      $mail_corps .= "Demande de : $nom\r\n";
      $mail_corps .= "Mail : $email\r\n"; 
      $mail_corps .= "\r\n";
      $mail_corps .= "Message du client : $msg\r\n\r\n";

   //Préparation de l'entête du mail:
      $boundary = '-----=' . md5(uniqid(mt_rand()));
      $mail_entete = "From: $email\r\n";
      $mail_entete .= "Reply-To: $email\r\n";
      $mail_entete .= "MIME-Version: 1.0\r\n";
      $mail_entete .= 'Content-Type: multipart/mixed; boundary="'.$boundary.'"'."\r\n";
      $mail_entete .= "X-Mailer: PHP/" . phpversion() . "\r\n" ;

   //Corps du mail en commençant par le message principal
      $message = '--'.$boundary."\r\n";
      $message .= 'Content-Type: text/plain; charset="utf-8"'."\r\n";
      $message .= 'Content-Transfer-Encoding: 8bit'."\r\n";
      $message .= "\r\n";
      $message .= $mail_corps."\r\n";
      $message .= "\r\n";

   //**********************PIECE JOINTE******************************//
      $fileuploads = $_FILES['fileupload']['name'];
      $source = $_FILES['fileupload']['tmp_name'];
      $file_type = $_FILES['fileupload']['type'];
      $file_size = $_FILES['fileupload']['size'];
      move_uploaded_file($source,"./fileuploads/".$fileuploads);

      if($fileuploads!="")
         {
            $file = $fileuploads;
            $handle = fopen($file,'rb');
            $content = fread($handle, $file_size);
            fclose($handle);
            $content = chunk_split(base64_encode($content));
            $message .= '--'.$boundary."\r\n";
            $message .= 'Content-type:'.$file_type.';name='.$fileuploads."\r\n";
            $message .= 'Content-transfer-encoding:base64'."\r\n";
            $message .= 'Content-Disposition:attachement; filename='.$fileuploads.'\r\n';
            $message .= '\r\n';
            $message .= $content."\r\n"; 
            $message .= '--'.$boundary.'--'; 
         
         }      

      // envoi du mail
       mail($to,"E-mail envoyé de Adexa WebSite",$message , $mail_entete);
       
?>



Ça fait quelque jour que je cherche une solution sans sucés.

Merci d'avance pour votre aide