PHPackages                             ninhtqse/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. [HTTP &amp; Networking](/categories/http)
4. /
5. ninhtqse/php-imap

ActiveLibrary[HTTP &amp; Networking](/categories/http)

ninhtqse/php-imap
=================

PHP IMAP client

22261PHP

Since Apr 20Pushed 5y ago1 watchersCompare

[ Source](https://github.com/ninhtqse/php-imap)[ Packagist](https://packagist.org/packages/ninhtqse/php-imap)[ RSS](/packages/ninhtqse-php-imap/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (1)

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

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

[![Latest Version on Packagist](https://camo.githubusercontent.com/51ede80ebd30e1a5d815f3276deb7f2b98991b7d6737c531057c52225f38cbe3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f5765626b6c65782f7068702d696d61702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/Webklex/php-imap)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](https://github.com/Webklex/php-imap/blob/master/LICENSE)[![Build Status](https://camo.githubusercontent.com/f0047ce6fcd9df7c8d5b583a81730a18c627e214b5042d9096ff1674a040e9e4/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f5765626b6c65782f7068702d696d61702f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/Webklex/php-imap/code-structure)[![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)

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)

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

[](#table-of-contents)

- [Documentations](#documentations)
- [Basic usage example](#basic-usage-example)
- [Known issues](#known-issues)
- [Support](#support)
- [Features &amp; pull requests](#features--pull-requests)
- [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/)

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 gives an impression on how things work.

```
use Webklex\PHPIMAP\ClientManager;

$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 ben moved';
        }else{
            echo 'Message could not be moved';
        }
    }
}
```

### 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 ;)

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

21

—

LowBetter than 18% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity30

Early-stage or recently created project

 Bus Factor1

Top contributor holds 92.6% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/996243095229cccc7202a11464dd63fc8b9a0f7b29e10219f1f285ac3c68df22?d=identicon)[ninhtqse](/maintainers/ninhtqse)

---

Top Contributors

[![Webklex](https://avatars.githubusercontent.com/u/2884144?v=4)](https://github.com/Webklex "Webklex (225 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)")[![ninhtqse](https://avatars.githubusercontent.com/u/64245514?v=4)](https://github.com/ninhtqse "ninhtqse (2 commits)")[![dwalczyk](https://avatars.githubusercontent.com/u/61882865?v=4)](https://github.com/dwalczyk "dwalczyk (2 commits)")[![peanut24](https://avatars.githubusercontent.com/u/5346088?v=4)](https://github.com/peanut24 "peanut24 (2 commits)")[![dwalck](https://avatars.githubusercontent.com/u/61882865?v=4)](https://github.com/dwalck "dwalck (2 commits)")[![mennovanhout](https://avatars.githubusercontent.com/u/26040589?v=4)](https://github.com/mennovanhout "mennovanhout (1 commits)")[![mikemiller891](https://avatars.githubusercontent.com/u/66344776?v=4)](https://github.com/mikemiller891 "mikemiller891 (1 commits)")[![Slauta](https://avatars.githubusercontent.com/u/1894301?v=4)](https://github.com/Slauta "Slauta (1 commits)")

### Embed Badge

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

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

###  Alternatives

[php-http/cache-plugin

PSR-6 Cache plugin for HTTPlug

25126.1M82](/packages/php-http-cache-plugin)[illuminate/http

The Illuminate Http package.

11937.9M6.9k](/packages/illuminate-http)[rdkafka/rdkafka

A PHP extension for Kafka

2.2k24.3k1](/packages/rdkafka-rdkafka)[httpsoft/http-message

Strict and fast implementation of PSR-7 and PSR-17

87965.9k114](/packages/httpsoft-http-message)[mezzio/mezzio-router

Router subcomponent for Mezzio

265.4M90](/packages/mezzio-mezzio-router)[serpapi/google-search-results-php

Get Google, Bing, Baidu, Ebay, Yahoo, Yandex, Home depot, Naver, Apple, Duckduckgo, Youtube search results via SerpApi.com

69127.2k](/packages/serpapi-google-search-results-php)

PHPackages © 2026

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