Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // vérif
- if(!isset($_POST['nom']) && !isset($_POST['prenom']) && !isset($_POST['mail']) && !isset($_POST['message'])) return header('Location: index.php?mail=false');
- if(empty($_POST['nom']) && empty($_POST['prenom']) && empty($_POST['mail']) && empty($_POST['message'])) return header('Location: index.php?mail=false');
- require 'PHPMailer/PHPMailerAutoload.php';
- $mail = new PHPMailer;
- $mail->isSMTP(); // Utiliser le SMTP
- $mail->Host = 'SSL0.OVH.NET'; // Serveur SMTP
- $mail->SMTPAuth = true; // Activer l'auth
- $mail->Username = 'admin@gregory-g.me'; // Login SMTP
- $mail->Password = 'mdp'; // Mot de passe SMTP
- $mail->SMTPSecure = 'ssl'; // Activer SSL
- $mail->Port = 465; // PORT
- $mail->setFrom('admin@gregory-g.me', 'Gregory G.'); // Adresse d'expéditeur
- $mail->addAddress('mailperso.gregory@gmail.com'); // Adresse de réception
- $mail->addAddress($_POST['mail']); // Ajouter en copie l'utilisateur qui envoie le formulaire
- $mail->isHTML(true);
- $mail->Subject = 'Nouveau message Gregory G.';
- $message = '<b>Nom</b> : '.htmlentities($_POST['nom']).'<br><b>Prenom</b> : '.htmlentities($_POST['prenom']).'<br><b>Mail</b> : '.htmlentities($_POST['mail']).'<br><b>Message</b> : '.nl2br(htmlentities($_POST['message'])); // contenu msg
- $mail->Body = $message;
- if(!$mail->send()) {
- header('Location: index.php?mail=false'); // si mail pas envoyé
- } else {
- header('Location: index.php?mail=true'); // si mail envoyé
- }
- ?>
Add Comment
Please, Sign In to add comment