IMAP Options in Email Support
When the KBS Email Support extension connects to your mailbox, it does so using the standard IMAP flags. These include the mailbox server host name, the protocol to use (IMAP/POP3), the port number and the transport security.
However, from time to time, you may need to send additional flags in order to obtain a successful connection. This article describes how.
Let’s say, for example, you’re connecting to a mailbox server and that server has a self-signed certificate that cannot be validated publicly. The connection from Email Support will fail as we expect to see a certificate that can be validated.
To resolve this, and successfully connect to your mailbox server, you will need to hook into the kbs_ems_mailbox_additional_flags
filter and specify the novalidate-cert
as an additional flag.
This can be achieved as follows;
/** * Add novalidate-cert flag to mailbox connection for KBS Email Support */ function kbs_demo_ems_additional_flags( $flags ) { $flags[] = 'novalidate-cert'; return $flags; } // kbs_demo_ems_additional_flags add_filter( 'kbs_ems_mailbox_additional_flags', 'kbs_demo_ems_additional_flags' );
The function above adds the novalidate-cert
flag to the filtered $flags
array and during connection, KBS Email Support will not validate the certificate, resulting in a successful connection.
Using the kbs_ems_mailbox_additional_flags
filter, KBS Email Support, will determine if the $flags
array is empty (default), and if it is not, the contents will be imploded onto the end of the IMAP connection string, with each array element separated by a forwards slash (/
). The $flags
array is run through the array_unique
filter before being appended.
A full listing of possible IMAP flags can be found here.