Skip to content

Conversation

Shubalar
Copy link

@Shubalar Shubalar commented Apr 2, 2025

php-imap has no ability to accept oauth token, and probably won't receive it due to the fact that it has been unbundled as of php 8.4.

This is resolved by using the javanile php-imap2 implementation, which has the ability to authenticate via an oauth token.

To use OAuth authentication:

Fill the password field with the token.
Supply the OP_XOAUTH2 constant to the \Mailbox->setConnectionArgs().

P.S.: Also see the following comment by the author of php-imap2, ddeboer/imap#443 (comment)

…eive it due to the fact that it has been unbundled as of php 8.4.

This is resolved by using the javanile php-imap2 implementation, which has the ability to authenticate via an oauth token.

To use OAuth authentication:

    Fill the password field with the token.
    Supply the OP_XOAUTH2 constant to the \Mailbox->setConnectionArgs().

P.S.: Also see the following comment by the author of php-imap2, ddeboer/imap#443 (comment)
@Shubalar
Copy link
Author

Shubalar commented Apr 3, 2025

@Sebbo94BY Could you please review this pull request.

@Arkemlar
Copy link

Arkemlar commented Apr 4, 2025

Seems like https://github.com/javanile/php-imap2 not ideal replacement. This comment reveals why:

Unfortunately, the reliability of the library https://github.com/javanile/php-imap2 is a major concern, as it breaks at multiple levels, even critical PRs on it are not integrated. Not to mention, the roundcube library it uses under the hood, has it's own issues with getting stuck and time-outs.

And nothing changed so far. That repo still has lots of pending PR, even with critical fixes (which is revealing questionable quality of lib, because even namespaces mixed up so hard). And much more open issues reporting bugs. Also no real code changes since Oct 27, 2022 (more recent commits not involve .php files edits).

@Shubalar
Copy link
Author

Shubalar commented Apr 8, 2025

I haven't really looked into it that deeply but as far as i can tell @francescobianco is a contributor to the php-imap2 repository and should be able to fix some of the pending issues.

@Shubalar
Copy link
Author

Shubalar commented Apr 8, 2025

According to php/pecl-mail-imap#15 it might be that the pecl version of imap might get direct support for OAuth tokens, which would eliminate the need for php-imap2.

But it later on also states:

I think the imap extension has to be considered obsolete. It can't really be removed in an upcoming PHP major version, since it has already been unbundled, and anybody can do with it what they like (assuming the license is adhered to). Therefore a deprecation doesn't make much sense (besides the technical challenge of deprecating an extension; could likely only deprecate the functions and constants).

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

Successfully merging this pull request may close these issues.

2 participants