problème avec phpmailer
Posté : 05 avr. 2011, 19:20
Code : Tout sélectionner
$mail = new PHPMailer();
//$body = file_get_contents('examples/contents.html"); // $mail->getFile(...) is invalid !
$body = "<body style=\"margin: 10px;\">
<div style=\"width: 640px; font-family: Arial, Helvetica, sans-serif;
font-size: 11px;\">
<br>
This is a test of PHPMailer.<br>
<br>
This particular example uses <strong>HTML</strong>, with a <div> tag
and inline<br>
styles.<br>
</div>
</body>
";
$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 = "[email protected]"; // GMAIL username
$mail->Password = "*********"; // GMAIL password
$mail->From = "[email protected]";
$mail->FromName = "*********";
//$mail->Subject = "This is the subject";
//$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->Body='Voici un exemple d\'e-mail au format Texte';
//$mail->AddReplyTo("[email protected]","JP");
//$mail->AddAttachment("C:/Development/ToolsPHP/PHPMailer_v5.1/examples/images/phpmailer.gif"); //
attachment
$mail->AddAddress("[email protected]");
//$mail->IsHTML(true); // send as HTML
if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message has been sent";
}