Download the PHP package devmastersbv/imap without Composer
On this page you can find all versions of the php package devmastersbv/imap. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download devmastersbv/imap
More information about devmastersbv/imap
Files in devmastersbv/imap
Informations about the package imap
IMAP library
A PHP 5.4+ library to read and process e-mails over IMAP.
Installation
Make sure the PHP IMAP extension is installed. For instance on Debian:
The recommended way to install the IMAP library is through Composer:
This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation.
Usage
Connect and Authenticate
Options
You can specify port, flags and parameters to the server:
Mailboxes
Retrieve mailboxes (also known as mail folders) from the mail server and iterate over them:
Or retrieve a specific mailbox:
Delete a mailbox:
Messages
Retrieve messages (e-mails) from a mailbox and iterate over them:
Searching for Messages
Message Properties and Operations
Get message number and unique message id in the form <...>:
Get other message properties:
Get message headers as a \Ddeboer\Imap\Message\Headers object:
Get message body as HTML or plain text:
Reading the message body marks the message as seen. If you want to keep the message unseen:
Move a message to another mailbox:
Deleting messages:
Message Attachments
Get message attachments (both inline and attached) and iterate over them:
Download a message attachment to a local file:
Running the Tests
This library is functionally tested on Travis CI against the Gmail IMAP server.
If you have your own IMAP (test) account, you can run the tests locally by providing your IMAP (e.g., Gmail) credentials:
You can also set an EMAIL_SERVER
variable, which defaults to imap.gmail.com
: