fMailbox

Class Resources

Contents

Email Classes

The fMailbox class provides an interface to list, fetch and delete emails from POP3 and IMAP servers. It fully parses the messages, handles attachments, related content and inline files. All text content is converted to UTF-8. This class does not require the PHP imap extension. Secure connections are supported if the openssl extension is installed.

Instantiation

To create a mailbox object, you must provide the $type (either pop3 or imap), $server, $username and $password.

Like fetchMessage(), it also supports a second, optional boolean parameter $convert_newlines to change \r\n into \n for text and html.

S/MIME Decryption and Verification

One of the more advanced features of fMailbox is the ability to seamlessly handle S/MIME signed and encrypted messages. The static method addSMIMEPair() accepts an $email_address and either a single S/MIME $certificate_file path or that combined with an S/MIME $private_key_file path and $private_key_password.

If the certificate is provided, messages coming from the $email_address and S/MIME signed will be checked for authenticity. Currently the class is configured to only verify messages with an explicitly added key, and will not use the certificate included in the signature.

If the private key and certificate are provided, any messages coming to the $email_address and S/MIME encrypted will be decrypted. The parsed message will contain the decrypted content in the appropriate text, html, attachment, etc. sections of the parsed message array.

If verification succeeds, the verified key will be set to TRUE in the parsed message array. If decryption is successful, the decrypted key will be set to TRUE. If either fail, or a certificate or key is not available for the specified email address, the S/MIME signature or encrypted message will appear as a file in the attachment element.