Skip to content

Instantly share code, notes, and snippets.

Last active Oct 29, 2019
What would you like to do?
Tuto : Comment envoyer des mails en PHPMailer[Testmail.php]
//Inclure la classe PHPMailer
require "PHPMailer/PHPMailerAutoload.php";
function smtpmailer($to, $from, $from_name, $subject, $body)
$mail = new PHPMailer();
$mail->SMTPAuth = true;
$mail->SMTPSecure = 'ssl';
$mail->Host = '';
$mail->Port = 465;
$mail->Username = '';
$mail->Password = 'votre_mot_de_passe';
$lien = 'votreducument.pdf';
$mail->AddReplyTo($from, $from_name);
$mail->Subject = $subject;
$mail->Body = $body;
$error ="Erreur...";
return $error;
$error = "Merci. Votre message a été bien envoyé.";
return $error;
//Envoie du mail
$to = ''
$from = '';
$name = 'Le nom de votre site ou companie';
$subj = 'Ceci est un message de test pour PHPMailer';
$msg = 'Votre message ici';
$error=smtpmailer($to,$from, $name ,$subj, $msg);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment