PHPackages                             mkrolready/php-imap - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Mail &amp; Notifications](/categories/mail)
4. /
5. mkrolready/php-imap

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

mkrolready/php-imap
===================

PHP IMAP client

v2.0.0(1y ago)13.5kMITPHPPHP ^8.0.2

Since May 18Pushed 11mo agoCompare

[ Source](https://github.com/mkrolready/php-imap)[ Packagist](https://packagist.org/packages/mkrolready/php-imap)[ Docs](https://github.com/webklex/php-imap)[ Fund](https://www.buymeacoffee.com/webklex)[ Fund](https://ko-fi.com/webklex)[ RSS](/packages/mkrolready-php-imap/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (4)Versions (4)Used By (0)

IMAP Library for PHP
====================

[](#imap-library-for-php)

[![Latest release on Packagist](https://camo.githubusercontent.com/142852f622bbcf734787efabdce1019dfac29ceaf8fd10de086706aec2675524/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f5765626b6c65782f7068702d696d61702e7376673f7374796c653d666c61742d737175617265266c6162656c3d76657273696f6e)](https://packagist.org/packages/Webklex/php-imap)[![Latest prerelease on Packagist](https://camo.githubusercontent.com/181ad0b7f5139e391b8a29eb732fc01bef80c4facc377ade7a51882f352dd3e9/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f7765626b6c65782f7068702d696d61703f696e636c7564655f70726572656c6561736573267374796c653d666c61742d737175617265266c6162656c3d7072652d72656c65617365)](https://packagist.org/packages/Webklex/php-imap)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](https://github.com/Webklex/php-imap/blob/master/LICENSE)[![Total Downloads](https://camo.githubusercontent.com/095b04338c33d3732932ec5233258d879813091fe55721061687aaa33f8b28b0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f5765626b6c65782f7068702d696d61702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/Webklex/php-imap)[![Hits](https://camo.githubusercontent.com/3d0c66224e82cc1267b034c33b902fcddccc1d90596082538461da2fccc0eaa8/68747470733a2f2f686974732e7765626b6c65782e636f6d2f7376672f7765626b6c65782f7068702d696d6170)](https://hits.webklex.com)[![Discord](https://camo.githubusercontent.com/4ad30c86d0a652df92d405540650f42db0147223b8be76ad2f1e4f1791ae7ecd/68747470733a2f2f696d672e736869656c64732e696f2f7374617469632f76313f6c6162656c3d646973636f7264266d6573736167653d6f70656e26636f6c6f723d353836356632267374796c653d666c61742d737175617265)](https://discord.gg/vUHrbfbDr9)[![Snyk](https://camo.githubusercontent.com/20e6f987efc5803350feab12d0668250407f00ed5fec352c93284418ca875b4f/68747470733a2f2f736e796b2d7769646765742e6865726f6b756170702e636f6d2f62616467652f636f6d706f7365722f7765626b6c65782f7068702d696d61702f62616467652e737667)](https://snyk.io/vuln/composer:webklex%2Fphp-imap)

Description
-----------

[](#description)

PHP-IMAP is a wrapper for common IMAP communication without the need to have the php-imap module installed / enabled. The protocol is completely integrated and therefore supports IMAP IDLE operation and the "new" oAuth authentication process as well. You can enable the `php-imap` module in order to handle edge cases, improve message decoding quality and is required if you want to use legacy protocols such as pop3.

Official documentation: [php-imap.com](https://www.php-imap.com/)

Laravel wrapper: [webklex/laravel-imap](https://github.com/Webklex/laravel-imap)

Discord: [discord.gg/rd4cN9h6](https://discord.gg/vUHrbfbDr9)

Table of Contents
-----------------

[](#table-of-contents)

- [Documentations](#documentations)
- [Compatibility](#compatibility)
- [Basic usage example](#basic-usage-example)
- [Sponsors](#sponsors)
- [Testing](#testing)
- [Known issues](#known-issues)
- [Support](#support)
- [Features &amp; pull requests](#features--pull-requests)
- [Alternatives &amp; Different Flavors](#alternatives--different-flavors)
- [Security](#security)
- [Credits](#credits)
- [License](#license)

Documentations
--------------

[](#documentations)

- Legacy (&lt; v2.0.0): [legacy documentation](https://github.com/Webklex/php-imap/tree/1.4.5)
- Core documentation: [php-imap.com](https://www.php-imap.com/)

Compatibility
-------------

[](#compatibility)

VersionPHP 5.6PHP 7PHP 8v6.x//Xv5.x//Xv4.x/XXv3.x/X/v2.xXX/v1.xX//Basic usage example
-------------------

[](#basic-usage-example)

This is a basic example, which will echo out all Mails within all imap folders and will move every message into INBOX.read. Please be aware that this should not be tested in real life and is only meant to give an impression on how things work.

```
use Webklex\PHPIMAP\ClientManager;

require_once "vendor/autoload.php";

$cm = new ClientManager('path/to/config/imap.php');

/** @var \Webklex\PHPIMAP\Client $client */
$client = $cm->account('account_identifier');

//Connect to the IMAP Server
$client->connect();

//Get all Mailboxes
/** @var \Webklex\PHPIMAP\Support\FolderCollection $folders */
$folders = $client->getFolders();

//Loop through every Mailbox
/** @var \Webklex\PHPIMAP\Folder $folder */
foreach($folders as $folder){

    //Get all Messages of the current Mailbox $folder
    /** @var \Webklex\PHPIMAP\Support\MessageCollection $messages */
    $messages = $folder->messages()->all()->get();

    /** @var \Webklex\PHPIMAP\Message $message */
    foreach($messages as $message){
        echo $message->getSubject().'';
        echo 'Attachments: '.$message->getAttachments()->count().'';
        echo $message->getHTMLBody();

        //Move the current Message to 'INBOX.read'
        if($message->move('INBOX.read') == true){
            echo 'Message has been moved';
        }else{
            echo 'Message could not be moved';
        }
    }
}
```

Sponsors
--------

[](#sponsors)

[![elb-BIT](https://camo.githubusercontent.com/4bb13fecc9bd58b5c0ef99e4674bfa9bbe3b35b26f845a4a1a837d9854d747d0/68747470733a2f2f7777772e656c622d6269742e64652f757365722f7468656d65732f64656c697665722f696d616765732f6c6f676f5f736d616c6c2e706e67)](https://www.elb-bit.de?ref=webklex/php-imap)[![Feline](https://camo.githubusercontent.com/c610e0e0c43de47f643db0ad4adb52d6b95055e134af18c5685216561052c3bf/68747470733a2f2f63646e2e66656c696e652e646b2f7075626c69632f66656c696e652e706e67)](https://www.feline.dk)

Testing
-------

[](#testing)

To run the tests, please execute the following command:

```
composer test
```

### Quick-Test / Static Test

[](#quick-test--static-test)

To disable all test which require a live mailbox, please copy the `phpunit.xml.dist` to `phpunit.xml` and adjust the configuration:

```

```

### Full-Test / Live Mailbox Test

[](#full-test--live-mailbox-test)

To run all tests, you need to provide a valid imap configuration.

To provide a valid imap configuration, please copy the `phpunit.xml.dist` to `phpunit.xml` and adjust the configuration:

```

```

The test account should **not** contain any important data, as it will be deleted during the test. Furthermore, the test account should be able to create new folders, move messages and should **not** be used by any other application during the test.

It's recommended to use a dedicated test account for this purpose. You can use the provided `Dockerfile` to create an imap server used for testing purposes.

Build the docker image:

```
cd .github/docker

docker build -t php-imap-server .
```

Run the docker image:

```
docker run --name imap-server -p 993:993 --rm -d php-imap-server
```

Stop the docker image:

```
docker stop imap-server
```

### Known issues

[](#known-issues)

ErrorSolutionKerberos error: No credentials cache file found (try running kinit) (...)Uncomment "DISABLE\_AUTHENTICATOR" inside your config and use the `legacy-imap` protocolSupport
-------

[](#support)

If you encounter any problems or if you find a bug, please don't hesitate to create a new [issue](https://github.com/Webklex/php-imap/issues). However, please be aware that it might take some time to get an answer. Off-topic, rude or abusive issues will be deleted without any notice.

If you need **commercial** support, feel free to send me a mail at .

##### A little notice

[](#a-little-notice)

If you write source code in your issue, please consider to format it correctly. This makes it so much nicer to read
and people are more likely to comment and help :)

```php

echo 'your php code...';

```

will turn into:

```
echo 'your php code...';
```

Features &amp; pull requests
----------------------------

[](#features--pull-requests)

Everyone can contribute to this project. Every pull request will be considered, but it can also happen to be declined.
To prevent unnecessary work, please consider to create a [feature issue](https://github.com/Webklex/php-imap/issues/new?template=feature_request.md)
first, if you're planning to do bigger changes. Of course, you can also create a new [feature issue](https://github.com/Webklex/php-imap/issues/new?template=feature_request.md)if you're just wishing a feature ;)

Alternatives &amp; Different Flavors
------------------------------------

[](#alternatives--different-flavors)

This library and especially the code flavor It's written in, is certainly not for everyone. If you are looking for a different approach, you might want to check out the following libraries:

- [ddeboer/imap](https://github.com/ddeboer/imap)
- [barbushin/php-imap](https://github.com/barbushin/php-imap)
- [DirectoryTree/ImapEngine](https://github.com/DirectoryTree/ImapEngine)

Change log
----------

[](#change-log)

Please see [CHANGELOG](https://github.com/Webklex/php-imap/blob/master/CHANGELOG.md) for more information what has changed recently.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Webklex](https://github.com/webklex)
- [All Contributors](https://github.com/Webklex/php-imap/graphs/contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](https://github.com/Webklex/php-imap/blob/master/LICENSE) for more information.

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance50

Moderate activity, may be stable

Popularity18

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 90.3% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~360 days

Total

3

Last Release

376d ago

Major Versions

v1.0.1 → v2.0.02025-05-07

PHP version history (3 changes)v1.0.0PHP ^7.4

v1.0.1PHP ^7.4 || ^8.1

v2.0.0PHP ^8.0.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/9f85b1875fbf7339e0e36b8641e25b8e50380367db6ad70700444dec12c84002?d=identicon)[mkrolready](/maintainers/mkrolready)

---

Top Contributors

[![Webklex](https://avatars.githubusercontent.com/u/2884144?v=4)](https://github.com/Webklex "Webklex (537 commits)")[![szymekjanaczek](https://avatars.githubusercontent.com/u/74879123?v=4)](https://github.com/szymekjanaczek "szymekjanaczek (8 commits)")[![thin-k-design](https://avatars.githubusercontent.com/u/4499116?v=4)](https://github.com/thin-k-design "thin-k-design (4 commits)")[![Max13](https://avatars.githubusercontent.com/u/531249?v=4)](https://github.com/Max13 "Max13 (4 commits)")[![DasTobbel](https://avatars.githubusercontent.com/u/5870230?v=4)](https://github.com/DasTobbel "DasTobbel (3 commits)")[![laurent-rizer](https://avatars.githubusercontent.com/u/52099563?v=4)](https://github.com/laurent-rizer "laurent-rizer (3 commits)")[![InterLinked1](https://avatars.githubusercontent.com/u/24227567?v=4)](https://github.com/InterLinked1 "InterLinked1 (2 commits)")[![latypoff](https://avatars.githubusercontent.com/u/11870079?v=4)](https://github.com/latypoff "latypoff (2 commits)")[![Magiczne](https://avatars.githubusercontent.com/u/8850255?v=4)](https://github.com/Magiczne "Magiczne (2 commits)")[![arnolem](https://avatars.githubusercontent.com/u/2263103?v=4)](https://github.com/arnolem "arnolem (2 commits)")[![bierpub](https://avatars.githubusercontent.com/u/5347727?v=4)](https://github.com/bierpub "bierpub (2 commits)")[![dwalck](https://avatars.githubusercontent.com/u/61882865?v=4)](https://github.com/dwalck "dwalck (2 commits)")[![grnsv](https://avatars.githubusercontent.com/u/70471000?v=4)](https://github.com/grnsv "grnsv (2 commits)")[![HelloSebastian](https://avatars.githubusercontent.com/u/76404254?v=4)](https://github.com/HelloSebastian "HelloSebastian (2 commits)")[![netpok](https://avatars.githubusercontent.com/u/6945600?v=4)](https://github.com/netpok "netpok (2 commits)")[![nuernbergerA](https://avatars.githubusercontent.com/u/13331388?v=4)](https://github.com/nuernbergerA "nuernbergerA (2 commits)")[![peanut24](https://avatars.githubusercontent.com/u/5346088?v=4)](https://github.com/peanut24 "peanut24 (2 commits)")[![rskrzypczak](https://avatars.githubusercontent.com/u/10221999?v=4)](https://github.com/rskrzypczak "rskrzypczak (2 commits)")[![ferrisbuellers](https://avatars.githubusercontent.com/u/23400472?v=4)](https://github.com/ferrisbuellers "ferrisbuellers (1 commits)")[![didi1357](https://avatars.githubusercontent.com/u/9483742?v=4)](https://github.com/didi1357 "didi1357 (1 commits)")

---

Tags

mailphp-imapimappop3webklex

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/mkrolready-php-imap/health.svg)

```
[![Health](https://phpackages.com/badges/mkrolready-php-imap/health.svg)](https://phpackages.com/packages/mkrolready-php-imap)
```

###  Alternatives

[webklex/php-imap

PHP IMAP client

4365.5M14](/packages/webklex-php-imap)[php-imap/php-imap

Manage mailboxes, filter/get/delete emails in PHP (supports IMAP/POP3/NNTP)

1.7k12.9M42](/packages/php-imap-php-imap)[webklex/laravel-imap

Laravel IMAP client

7164.2M13](/packages/webklex-laravel-imap)[directorytree/imapengine

A fully-featured IMAP library -- without the PHP extension

531175.4k4](/packages/directorytree-imapengine)[benhall14/php-imap-reader

A PHP class that makes working with IMAP in PHP simple.

3516.6k](/packages/benhall14-php-imap-reader)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
