meta data for this page
This is an old revision of the document!
Imap2 plugin
Description: This plugin enables the phplist bounce processing when the php IMAP extension is not installed.
Author : Duncan Cameron
source repo : https://github.com/bramley/phplist-plugin-imap2/
Purpose
This plugin uses the javanile/php-imap2 package to emulate the php imap_xxx functions that are used by phplist for bounce processing.
Those functions are provided by the IMAP extension, but that extension has been removed in php version 8.4. This plugin provides an alternative implementation that will allow phplist to continue processing bounces.
This plugin can also be used with php versions prior to 8.4 if the hosting provider does not provide the IMAP extension.
If your php configuration already includes the IMAP extension then you do not need this plugin. The plugin can be installed but will not have any effect.
Installation
See the README file on the GitHub page https://github.com/bramley/phplist-plugin-imap2 for how to install the plugin.
Usage
Use of localhost
Using localhost
for the bounce mailbox host is not supported, the server name should be used instead. For example instead of
$bounce_mailbox_host = 'localhost';
use something like
$bounce_mailbox_host = 'mail.mysite.com';
Use IMAP instead of POP3
The php-imap2 package supports only the IMAP protocol, not the POP3 protocol. This is compatible with the phplist bounce processing and should not be a problem.
The plugin will detect when POP3 is trying to be used and change the port and protocol to the equivalent IMAP values but for clarity you may want to change the setting in the config.php file. You might also need to change the value of $bounce_mailbox_host
because that might differ between POP3 and IMAP.
For example, if you currently access the mailbox using POP3
$bounce_mailbox_port = '110/pop3';
That needs to be changed to use IMAP on port 143
$bounce_mailbox_port = '143/imap';
Or if you currently access the mailbox using secure POP3
$bounce_mailbox_port = '995/pop3/ssl';
That needs to be changed to use IMAP on port 993
$bounce_mailbox_port = '993/imap/ssl';
Debugging
You can log the dialogue with the mail server by including /debug
within the value of $bounce_mailbox_port
, e.g.
$bounce_mailbox_port = '993/imap/ssl/debug';
and by setting a variable in config.php
$log_options = [ 'threshold' => 'DEBUG', ];
Now the plugin will write the dialogue to a file in the phplist temporary directory, identfied by the $tmpdir
variable in config.php. The file will be named for the current day, log_yyyy-mm-dd.txt
.
[06:33:10] [debug] [BC29] Connecting to ssl://imap.gmail.com:993... [06:33:10] [debug] [BC29] S: * OK Gimap ready for requests from 87.115.225.95 h41mb25057261wmp [06:33:10] [debug] [BC29] C: A0001 CAPABILITY [06:33:10] [debug] [BC29] S: * CAPABILITY IMAP4rev1 UNSELECT IDLE NAMESPACE QUOTA ID XLIST CHILDREN X-GM-EXT-1 XYZZY SASL-IR AUTH=XOAUTH2 AUTH=PLAIN AUTH=PLAIN-CLIENTTOKEN AUTH=OAUTHBEARER