Download the PHP package ddeboer/imap without Composer

On this page you can find all versions of the php package ddeboer/imap. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?
ddeboer/imap
Rate from 1 - 5
Rated 5.00 based on 1 reviews

Informations about the package imap

PHP IMAP library

Latest Stable Version Downloads Integrate Code Coverage

A PHP IMAP library to read and process e-mails over IMAP protocol, built with robust Object-Oriented architecture.

This library requires PHP >= 8.2 with IMAP, iconv and Multibyte String extensions installed.

Installation

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

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:

You can bulk set, or clear, any flag of mailbox messages (by UIDs):

WARNING You must retrieve new Message instances in case of bulk modify flags to refresh the single Messages flags.

Messages

Retrieve messages (e-mails) from a mailbox and iterate over them:

To insert a new message (that just has been sent) into the Sent mailbox and flag it as seen:

Note that the message should be a string at MIME format (as described in the RFC2045).

Searching for Messages

WARNING We are currently unable to have both spaces and double-quotes escaped together. Only spaces are currently escaped correctly. You can use Ddeboer\Imap\Search\RawExpression to write the complete search condition by yourself.

Messages can also be retrieved sorted as per imap_sort function:

Unknown search criterion: OR

Note that PHP imap library relies on the c-client library available at https://www.washington.edu/imap/ which doesn't fully support some IMAP4 search criteria like OR. If you want those unsupported criteria, you need to manually patch the latest version (imap-2007f of 23-Jul-2011 at the time of this commit) and recompile PHP onto your patched c-client library.

By the way most of the common search criteria are available and functioning, browse them in ./src/Search.

References:

  1. https://stackoverflow.com/questions/36356715/imap-search-unknown-search-criterion-or
  2. imap-2007f.tar.gz: ./src/c-client/mail.c and ./docs/internal.txt

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 (only first part):

Get complete body (all parts):

Reading the message body keeps the message as unseen. If you want to mark the message as seen:

Or you can set, or clear, any flag:

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:

Embedded Messages

Check if attachment is embedded message and get it:

An EmbeddedMessage has the same API as a normal Message, apart from flags and operations like copy, move or delete.

Timeouts

The IMAP extension provides the imap_timeout function to adjust the timeout seconds for various operations.

However the extension's implementation doesn't link the functionality to a specific context or connection, instead they are global. So in order to not affect functionalities outside this library, we had to choose whether wrap every imap_* call around an optional user-provided timeout or leave this task to the user.

Because of the heterogeneous world of IMAP servers and the high complexity burden cost for such a little gain of the former, we chose the latter.

Mock the library

Mockability is granted by interfaces present for each API. Dig into MockabilityTest for an example of a mocked workflow.

Contributing: run the build locally

Docker is needed to run the build on your computer.

First command you need to run is make start-imap-server, which starts an IMAP server locally.

Then the local build can be triggered with a bare make.

When you finish the development, stop the local IMAP server with make stop-imap-server.


All versions of imap with dependencies

PHP Build Version
Package Version
Requires php Version ~8.2.0 || ~8.3.0
ext-dom Version *
ext-iconv Version *
ext-imap Version *
ext-libxml Version *
ext-mbstring Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package ddeboer/imap contains the following files

Loading the files please wait ....