php / pecl-mail-imap

An extension to operate with the IMAP protocol, as well as the NNTP, POP3, and local mailbox access methods.
Other
7 stars 2 forks source link

IMAP PHP function - send custom comands before login RFC 2971 #8

Open bnchdan opened 3 months ago

bnchdan commented 3 months ago

Description

Hi,

I have a question about the imap PHP function https://www.php.net/manual/en/function.imap-open.php. Context: If you host an application ( with IP x.x.x.x ) that makes a login to an IMAP server with imap_open() function from a client with IP y.y.y.y. The logs on the IMAP server will show the x.x.x.x IP, not the IP from the client. If the IMAP server is Dovecot you can send a command before the login process ID ("x-originating-ip" "y.y.y.y" ) RFC 2971 https://datatracker.ietf.org/doc/html/rfc2971.html , and Dovecot will log the correct IP. https://doc.dovecot.org/configuration_manual/forwarding_parameters/

Is it possible to send the command ID ("x-originating-ip" "y.y.y.y" ) on imap_open() function or are you considering implementing it on a new version.?

Thanks

SakiTakamachi commented 3 months ago

@bnchdan

At least as far as I can see there is no such feature.

Maybe someone else knows something I haven't found, but if not, it'll need to be added if you want to use such functionality.

The IMAP extension are unbundled by RFC, so adding features should be done in the following repository:

https://github.com/php/pecl-mail-imap

nielsdos commented 3 months ago

As Saki points out, the extension is unbundled starting with PHP 8.4, and so new features should be requested on the PECL repo. Therefore, I transferred the issue here. Note that this extension uses the c-client library that has been unmaintained for over 10 years (which is the reason the extension is getting unbundled anyway). On first sight, it seems like the underlying library doesn't offer such functionality. All in all, I think you're better off using a userland PHP library that implements IMAP.