Aller au contenu

mayapi

Membre
  • Compteur de contenus

    1
  • Inscrit(e) le

  • Dernière visite

Réputation sur la communauté

0 Neutre
  1. Piece jointe avec phpmailer

    Salut ! J'ai un petit soucis avec phpmailer pour envoyer des pièces jointes ... Le message part bien mais la pièce jointe indique le message : Could not access file: Donc je me dis que je ne doit pas configurer quelque chose correctement ... Merci par avance pour votre aide ! <?php if(isset($_POST['submit'])) { $message= 'Nom complet: '.$_POST['fullname'].'<br /> Sujet: '.$_POST['subject'].'<br /> Telephone: '.$_POST['phone'].'<br /> Courriel: '.$_POST['emailid'].'<br /> Piece Jointe: '.$_POST['uploaded_file'].'<br /> Commentaire: '.$_POST['comments'].' '; require "candidature/class.phpmailer.php"; //include phpmailer 5.1 class // Instantiate Class phpmailer 5.1 $mail = new PHPMailer(); // Set up SMTP $mail->IsSMTP(); // Sets up a SMTP connection $mail->SMTPAuth = true; // Connection with the SMTP does require authorization $mail->SMTPSecure = "ssl"; // Connect using a TLS connection $mail->Host = "smtp.gmail.com"; //Gmail SMTP server address $mail->Port = 465; //Gmail SMTP port $mail->Encoding = '7bit'; // Authentication $mail->Username = "email@gmail.com"; // Your full Gmail address $mail->Password = "pass"; // Your Gmail password // Compose $mail->SetFrom($_POST['emailid'], $_POST['fullname']); $mail->AddReplyTo($_POST['emailid'], $_POST['fullname']); $mail->Subject = "MESSAGE DEPUIS MON SITE"; // Subject (which isn't required) $mail->MsgHTML($message); // Attachement $mail->AddAttachment($_FILES[uploaded_file]['name']); // Send To $mail->AddAddress("email@gmail.com", "Coordonnees securisees envoie et reception:"); // Where to send it - Recipient $result = $mail->Send(); // Send! $message = $result ? '<div class=" messageinfoenvoie">Votre message a été envoyer</div>' : '<div class=" messageinfoenvoie">Une erreur est survenue pendant l\'envoie de votre message !</div>'; unset($mail); } ?> <head> <link rel="stylesheet" type="text/css" href="candidature/css/style.css" media="screen"> </head> <div class="contactmarg"> <div class="container_12"> <p><?php if(!empty($message)) echo $message; ?></p> </div> <div class="container_12"> <div class="grid_12"> <form name="form1" id="form1" action="" method="post" enctype="multipart/form-data"> <fieldset> <input class="inputcontact" type="text" name="fullname" placeholder="Nom" required /> <br /> <input class="inputcontact" type="text" name="subject" placeholder="Sujet" required /> <br /> <input class="inputcontact" type="text" name="phone" placeholder="Téléphone" required /> <br /> <input class="inputcontact" type="text" name="emailid" placeholder="Courriel" required /> <br /> <input class="inputcontact" type="file" name="uploaded_file" /><br /> <textarea class="inputtextarea" name="comments" placeholder="Message" required></textarea> <br /> <input class="inputsubmit" type="submit" name="submit" value="Envoyer" /> </fieldset> </form> </div> </div> </div>
×