IMAP + GMAIL : connexion insolvable pour moi débutant
Bonjour
Je tente désespérément de récupérer le contenu de ma boite gmail mais impossible j ai le message d erreur suivant des la première tentative :
Citation:
Warning: imap_open(): Couldn't open stream {imap.gmail.com:993/imap/ssl/novalidate-cert}INBOX in E:\laragon\www\imap\gmail.php on line 67
Cannot connect to Gmail: Too many login failures
Notice: Unknown: [AUTHENTICATIONFAILED] Invalid credentials (Failure) (errflg=1) in Unknown on line 0
Notice: Unknown: [AUTHENTICATIONFAILED] Invalid credentials (Failure) (errflg=1) in Unknown on line 0
Notice: Unknown: [AUTHENTICATIONFAILED] Invalid credentials (Failure) (errflg=1) in Unknown on line 0
Notice: Unknown: Too many login failures (errflg=2) in Unknown on line 0
J ai tout essayé et je ne comprends pas pourquoi pke j'ai autorisé les applications moins sécurisées dans google, IMAP est bien sur activé chez google, j ai imap sur mon php avec ssl, j'utilise les bons identifiants...
voici mon code (un code pour tester récupéré en ligne):
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 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
| <h1>Gmail Email Inbox using PHP with IMAP</h1>
<?php
if (! function_exists('imap_open')) {
echo "IMAP is not configured.";
exit();
} else {
?>
<div id="listData" class="list-form-container">
<?php
/* Connecting Gmail server with IMAP */
$connection = imap_open('{imap.gmail.com:993/imap/ssl}INBOX', 'labonneadresse@gmail.com', 'lebonpasse') or die('<br/>Cannot connect to Gmail: ' . imap_last_error().'<br/>');
/* Search Emails having the specified keyword in the email subject */
$emailData = imap_search($connection, 'SUBJECT "Article "');
if (! empty($emailData)) {
?>
<table>
<?php
foreach ($emailData as $emailIdent) {
$overview = imap_fetch_overview($connection, $emailIdent, 0);
$message = imap_fetchbody($connection, $emailIdent, '1.1');
$messageExcerpt = substr($message, 0, 150);
$partialMessage = trim(quoted_printable_decode($messageExcerpt));
$date = date("d F, Y", strtotime($overview[0]->date));
?>
<tr>
<td><span class="column">
<?php echo $overview[0]->from; ?>
</span></td>
<td class="content-div"><span class="column">
<?php echo $overview[0]->subject; ?> - <?php echo $partialMessage; ?>
</span><span class="date">
<?php echo $date; ?>
</span></td>
</tr>
<?php
} // End foreach
?>
</table>
<?php
} // end if
imap_close($connection);
}
?>
</div> |
J ai aussi tenté cela pensant qu il s agissait d un pb d authentification:
Code:
$connection = imap_open('{imap.gmail.com:993/imap/ssl/novalidate-cert}INBOX', 'labonneadresse@gmail.com', 'lebonpasse') or die('<br/>Cannot connect to Gmail: ' . imap_last_error().'<br/>');
J ai donc besoin de votre aide pke là je m arrache le peu de cheveux qu il me resste.
D avance merci