Answer the question
In order to leave comments, you need to log in
How to get imap gmail php emails?
Trying a simple PHP example
$imap = imap_open('{imap.gmail.com:993/imap/ssl}INBOX', $username, $password);
$emails = imap_search($imap, 'ALL');
if($emails) echo count($emails);
imap_close($inbox);
PHP Warning: imap_open(): Couldn't open stream {imap.gmail.com:993/imap/ssl}INBOX
PHP Warning: imap_search() expects parameter 1 to be resource, bool given in
PHP Notice: Undefined variable: inbox in
PHP Warning: imap_close() expects parameter 1 to be resource, null given in
PHP Notice: Unknown: Retrying PLAIN authentication after [AUTHENTICATIONFAILED] Invalid credentials (Failure) (errflg=1) in Unknown on line 0
PHP Notice: Unknown: Retrying PLAIN authentication after [AUTHENTICATIONFAILED] Invalid credentials (Failure) (errflg=1) in Unknown on line 0
PHP Notice: Unknown: Can not authenticate to IMAP server: [AUTHENTICATIONFAILED] Invalid credentials (Failure) (errflg=2) in Unknown on line 0
telnet imap.gmail.com:993
telnet: could not resolve imap.gmail.com:993/telnet: Name or service not known
sudo apt install telnet
Reading package lists... Done
Building dependency tree
Reading state information... Done
telnet is already the newest version (0.17-41).
The following package was automatically installed and is no longer required:
libzip5
Use 'sudo apt autoremove' to remove it.
0 upgraded, 0 newly installed, 0 to remove and 24 not upgraded.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question