note 128359 added to function.imap-errors
| From: | olliejones at gmail dot com | Date: | Sat, 01 Apr 2023 17:17:53 +0000 |
| Subject: | note 128359 added to function.imap-errors | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-220317@lists.php.net to get a copy of this message | ||
This can generate the string "Mailbox is empty" right after a call to imap_open().
That's not an error. That means something like this is not good enough to know the open failed
due to a wrong password or host name or whatever. This
$imap = @imap_open( $mailbox, $user, $pass);
$errors = @imap_errors();
if ( $errors ) {
echo 'Login failed: ' . implode ('; ', $errors );
}
can output "Login failed: Mailbox is empty" which is silly.
Instead, check the return value from imap_open().
$imap = @imap_open( $mailbox, $user, $pass);
if ( ! $imap ) {
$errors = @imap_errors();
echo 'Login failed: ' . implode ('; ', $errors );
}
----
Server IP: 45.112.84.4
Probable Submitter: 80.90.13.130 (proxied: 2600:4040:5e03:8a00:2095:27b2:93e6:3890)
----
Manual Page -- https://php.net/manual/en/function.imap-errors.php
Edit -- https://main.php.net/note/edit/128359
Del: integrated -- https://main.php.net/note/delete/128359/integrated
Del: useless -- https://main.php.net/note/delete/128359/useless
Del: bad code -- https://main.php.net/note/delete/128359/bad+code
Del: spam -- https://main.php.net/note/delete/128359/spam
Del: non-english -- https://main.php.net/note/delete/128359/non-english
Del: in docs -- https://main.php.net/note/delete/128359/in+docs
Del: other reasons-- https://main.php.net/note/delete/128359
Reject -- https://main.php.net/note/reject/128359
Search -- https://main.php.net/manage/user-notes.php