Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

shared mailboxes in combination with OAUTH2 #31

Open
IZSkiSurfer opened this issue Nov 23, 2022 · 0 comments
Open

shared mailboxes in combination with OAUTH2 #31

IZSkiSurfer opened this issue Nov 23, 2022 · 0 comments

Comments

@IZSkiSurfer
Copy link

To support the so called shared mailboxes with OAUTH2 I would suggest following changes:

  1. Within the Connection class add a new protected property $sharedUser.
  2. Within the Connection classes openMailbox method add the following snippet: $this->sharedUser = array_reduce($mailboxParts['path'], function($carry, $item) { return preg_match('/^user=(.+)$/', $item, $matches) ? $matches[1] : $carry; }, false);
  3. Within the Connection classes connect method change the 2nd argument of the connect call to: ($this->flags & OP_XOAUTH2) && !empty($this->sharedUser) ? $this->sharedUser : $this->user
    Maybe the ($this->flags & OP_XOAUTH2) part in step 3 might be omitted - haven't tried php-imap2 with normal IMAP login in combination with shared mailboxes - in which case I would use PHP's integrated imap_ functions anyway :p
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant