Bonsoir à tous
je voulais envoyer un mail mon compte gmail
voici mon code
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
|
<?php
require('phpmailer/class.phpmailer.php');
$mail = new PHPMailer();
$mail->SetLanguage("en", 'phpMailer/language/');
$subject = "Test Mail using PHP mailer";
$content = "<b>This is a test mail using PHP mailer class.</b>";
$mail->IsSMTP();
$mail->SMTPDebug = 0;
$mail->SMTPAuth = TRUE;
$mail->SMTPSecure = "tls";
$mail->Port = 587;
$mail->Username = "monmail@gmail.com";
$mail->Password = "*******";
$mail->Host = "smtp.gmail.com";
$mail->Mailer = "smtp";
$mail->From = "monmail@gmail.com";
$mail->FromName = "moi";
//$mail->AddReplyTo("monmail@gmail.com", "PHPPot");
$mail->AddAddress("monmail@gmail.com");
$mail->Subject = $subject;
$mail->WordWrap = 80;
//$mail->MsgHTML($content);
//$mail->IsHTML(true);
if(!$mail->Send())
echo "Problem on sending mail".$mail->ErrorInfo;
else
echo "Mail sent";
?> |
voici mon erreur:
Problem on sending mailThe following From address failed: monmail@gmail.com
et j'ai reçu dans ma boite gmail qu'un accès est bloqué à ma boite
comment je peux régler ce problème et comment je peux configurer ma boite gmail pour permettre l'envoi des mail
Merci
Partager