Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ By default, this library uses random filenames for attachments as identical file
$mailbox = new PhpImap\Mailbox(
'{imap.gmail.com:993/imap/ssl}INBOX', // IMAP server and mailbox folder
'some@gmail.com', // Username for the before configured mailbox
'*********', // Password for the before configured username
'*********', // Password or token for the before configured username
__DIR__, // Directory, where attachments will be saved (optional)
'UTF-8', // Server encoding (optional)
true, // Trim leading/ending whitespaces of IMAP path (optional)
Expand All @@ -94,14 +94,9 @@ $mailbox = new PhpImap\Mailbox(
$mailbox->setConnectionArgs(
CL_EXPUNGE // expunge deleted mails upon mailbox close
| OP_SECURE // don't do non-secure authentication
| OP_XOAUTH2 // set OP_XOAUTH2 connection argument if supplied password is a OAuth token.
);

try {
$mailbox->setOAuthToken('TheOAuthAccessToken');
} catch (Exception $ex) {
die('Authentication using OAuth failed! Error: '.$ex->getMessage());
}

try {
// Get all emails (messages)
// PHP.net imap_search criteria: http://php.net/manual/en/function.imap-search.php
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
},
"require": {
"php": "^7.4 || ^8.0",
"javanile/php-imap2": "^0.1.10",
"ext-fileinfo": "*",
"ext-iconv": "*",
"ext-imap": "*",
Expand Down
4 changes: 1 addition & 3 deletions psalm.baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@
<code>$element-&gt;text</code>
<code>$element-&gt;text</code>
</InvalidArgument>
<PossiblyUnusedMethod occurrences="27">
<code>setOAuthToken</code>
<code>getOAuthToken</code>
<PossiblyUnusedMethod occurrences="24">
<code>setConnectionRetry</code>
<code>setConnectionRetryDelay</code>
<code>setExpungeOnDisconnect</code>
Expand Down
4 changes: 2 additions & 2 deletions src/PhpImap/DataPartInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,10 @@ public function decodeAfterFetch(string $data): string
{
switch ($this->encoding) {
case ENC8BIT:
$this->data = \imap_utf8((string) $data);
$this->data = \imap2_utf8((string) $data);
break;
case ENCBINARY:
$this->data = \imap_binary((string) $data);
$this->data = \imap2_binary((string) $data);
break;
case ENCBASE64:
$this->data = \base64_decode((string) $data, false);
Expand Down
Loading