par
miiidooo19 » 29 juin 2013, 17:13
oui alors j'ai vu sur internet est on me conseil d'utiliser la class phpmailer j'ai donc téléchager la class, et j'ai suivi un tuto et voici mon code
include("phpmailer/class.phpmailer.php");
include("phpmailer/class.smtp.php"); // note, this is optional - gets called from main class if not already loaded
date_default_timezone_set("Europe/Zurich");
$mail = new PHPMailer();
$body = 'test d\'un msg envoyer par la class phpmailer';
$mail->IsSMTP();
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->SMTPSecure = "ssl"; // sets the prefix to the servier
$mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server
$mail->Port = 465; // set the SMTP port
$mail->Username = "nom.prenom"; // GMAIL username
$mail->Password = "mon gmail mot de pass"; // GMAIL password
$mail->From = "[email protected]";
$mail->FromName = "nomPrenom";
$mail->Subject = "Nouveau msg";
$mail->AltBody = "This is the body when user views in plain text format"; //Text Body
$mail->WordWrap = 50; // set word wrap
$mail->MsgHTML($body);
$mail->AddReplyTo("[email protected]","JP");
$mail->AddAddress("[email protected]","XXX");
$mail->IsHTML(true); // send as HTML
if(!$mail->Send()) {
$msg = '<span style="color:red;">Erreur : Le message n\'a pu être envoyé, merci de reéssayer plus tard</span> ' . $mail->ErrorInfo;
} else {
$msg = '<span style="color:green;">Votre message a bien été envoyé, on vous répondera le plutôt possible,<br/> Merci pour votre confiance</span>';
}
et j'ai cette erreur Fatal error: Call to undefined method PHPMailer::MsgHTML() in line 91 qui correspond a $mail->MsgHTML($body);
oui alors j'ai vu sur internet est on me conseil d'utiliser la class phpmailer j'ai donc téléchager la class, et j'ai suivi un tuto et voici mon code
[php]
include("phpmailer/class.phpmailer.php");
include("phpmailer/class.smtp.php"); // note, this is optional - gets called from main class if not already loaded
date_default_timezone_set("Europe/Zurich");
$mail = new PHPMailer();
$body = 'test d\'un msg envoyer par la class phpmailer';
$mail->IsSMTP();
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->SMTPSecure = "ssl"; // sets the prefix to the servier
$mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server
$mail->Port = 465; // set the SMTP port
$mail->Username = "nom.prenom"; // GMAIL username
$mail->Password = "mon gmail mot de pass"; // GMAIL password
$mail->From = "
[email protected]";
$mail->FromName = "nomPrenom";
$mail->Subject = "Nouveau msg";
$mail->AltBody = "This is the body when user views in plain text format"; //Text Body
$mail->WordWrap = 50; // set word wrap
$mail->MsgHTML($body);
$mail->AddReplyTo("
[email protected]","JP");
$mail->AddAddress("
[email protected]","XXX");
$mail->IsHTML(true); // send as HTML
if(!$mail->Send()) {
$msg = '<span style="color:red;">Erreur : Le message n\'a pu être envoyé, merci de reéssayer plus tard</span> ' . $mail->ErrorInfo;
} else {
$msg = '<span style="color:green;">Votre message a bien été envoyé, on vous répondera le plutôt possible,<br/> Merci pour votre confiance</span>';
}
[/php]
et j'ai cette erreur Fatal error: Call to undefined method PHPMailer::MsgHTML() in line 91 qui correspond a $mail->MsgHTML($body);