1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
| <?php
try {
require("PHPMailer_v5.1/class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP(); // telling the class to use SMTP
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->Host = "smtp.live.com"; // SMTP server
$mail->Port = 25;
$mail->Username = "xxxxxx@hotmail.com";
$mail->Password = "yyyyyyy";
$mail->From = "aaaaaaa@hotmail.com";
$mail->AddAddress("bbbbbb@hotmail.com");
$mail->Subject = "Mail du test";
$mail->Body = "Hello word";
$mail->WordWrap = 50;
if(!$mail->Send())
{
echo 'Echec envoi message.';
echo 'Mailer error: ' . $mail->ErrorInfo;
}
else
{
echo 'Message has been sent.';
}
} catch (Exception $e) {
echo 'Exception : ', $e->getMessage(), "\n";
}
?> |
Partager