Impossible d'envoyer un mail
mobrobot
Messages postés
182
Statut
Membre
-
mobrobot Messages postés 182 Statut Membre -
mobrobot Messages postés 182 Statut Membre -
Bonsoir s'ils vous plais j'ai besoin d'aide, j'ai essayé d'envoi un mail avec mon script php mais ça ne marche du tous voici mon script d'envoi de mail
voici le script sendmail.ini
et le fichier php.ini
je vous remercie.
$header="MIME-Version: 1.0\r\n";
$header.='From:"Nomdeprojet"<supportprojet@gmail.com>'."\n";
$header.='Content-Type:text/html; charset="uft-8"'."\n";
$header.='Content-Transfer-Encoding: 8bit';
$message='
<html>
<body>
<div align="center">
j\'ai envoyé ce mail avec php !;
</div>
</body>
</html>
';
mail("maildel'utilisateur@gmail.com", "Confirmation de compte", $message, $header);
voici le script sendmail.ini
[sendmail] smtp_server=smtp.gmail.com smtp_port=587 default_domain=gmail.com error_logfile=error.log auth_username=supportprojet@gmail.com auth_password=supportprojet5897 pop3_server= pop3_username= pop3_password= force_sender=supportprojet@gmail.com force_recipient= hostname=
et le fichier php.ini
[mail function]
; For Win32 only.
; https://www.php.net/manual/en/mail.configuration.php#ini.smtp
SMTP = localhost
; https://www.php.net/manual/en/mail.configuration.php#ini.smtp-port
smtp_port = 25
; For Win32 only.
; https://www.php.net/manual/en/mail.configuration.php#ini.sendmail-from
sendmail_from = you@yourdomain
; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
; https://www.php.net/manual/en/mail.configuration.php#ini.sendmail-path
sendmail_path = "C:\wamp\sendmail\sendmail.exe"
je vous remercie.
1 réponse
-
Bonjour
Le compte gmail utilisé existe ?
Tu y a autorisé les applications externes ?
Tu as des choses dans le error.log ?
-
Oui le compte gmail utilisé existe.
comment autorisé les applications externers ?
voici le texte dans le fichier error19/03/17 07:48:58 : Username and Password not accepted. Learn more at<EOL> https://support.google.com/mail/answer/7126229?p=BadCredentials&visit_id=637167525794094787-1206485498&rd=2#cantsignin o1sm2251977wrs.51 - gsmtp<EOL>
19/03/17 08:11:26 : Username and Password not accepted. Learn more at<EOL> https://support.google.com/mail/answer/7126229?p=BadCredentials&visit_id=637167525794094787-1206485498&rd=2#cantsignin q5sm7202183wrn.43 - gsmtp<EOL>
19/03/17 08:17:58 : Username and Password not accepted. Learn more at<EOL> https://support.google.com/mail/answer/7126229?p=BadCredentials&visit_id=637167525794094787-1206485498&rd=2#cantsignin n188sm3834055wme.13 - gsmtp<EOL>
19/03/17 08:36:15 : Socket Error # 11001<EOL>Host not found.
19/03/17 08:36:43 : Username and Password not accepted. Learn more at<EOL> https://support.google.com/mail/answer/7126229?p=BadCredentials&visit_id=637167525794094787-1206485498&rd=2#cantsignin r6sm6223191wrx.48 - gsmtp<EOL>
19/03/17 08:40:11 : Username and Password not accepted. Learn more at<EOL> https://support.google.com/mail/answer/7126229?p=BadCredentials&visit_id=637167525794094787-1206485498&rd=2#cantsignin t62sm8117407wmf.15 - gsmtp<EOL>
19/03/17 08:41:57 : Username and Password not accepted. Learn more at<EOL> https://support.google.com/mail/answer/7126229?p=BadCredentials&visit_id=637167525794094787-1206485498&rd=2#cantsignin h137sm11771575wmg.41 - gsmtp<EOL>
19/03/17 08:45:31 : Username and Password not accepted. Learn more at<EOL> https://support.google.com/mail/answer/7126229?p=BadCredentials&visit_id=637167525794094787-1206485498&rd=2#cantsignin r10sm6311200wmh.21 - gsmtp<EOL> -
-
Bonsoir jordane45 j'ai suivie les instruction du lien que tu ma donné a la lettre, j'ai configuré le logiciel LocaGest et j'ai test la configuration sa marché le message de test est venue dans ma boit Gmail.
Voila ce qui me fatigue maintenant j'ai essayé d'envoyer un mail avec mon script php sur le même adresse mail sa ne fonctionne pas du tous, je sais pas qu'est qui fait ça. -
-
Bonjour,
Si tu tiens rééllement à utiliser un compte Gmail pour faire tes envois, je te conseille dans ce cas de passer par la class phpmailer au lieu de la fonction mail native de php.
https://github.com/PHPMailer/PHPMailer/blob/master/examples/gmail.phps
https://www.berejeb.com/2009/09/envoyer-des-mails-avec-phpmailer-et-le-smtp-de-gmail/
-