PHPackages                             macromindonline/laravel-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. macromindonline/laravel-imap

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

macromindonline/laravel-imap
============================

Laravel IMAP client

1.0.3.7(8y ago)021MITPHPPHP &gt;=5.5.9

Since Jan 19Pushed 8y ago1 watchersCompare

[ Source](https://github.com/macromindonline/laravel-imap)[ Packagist](https://packagist.org/packages/macromindonline/laravel-imap)[ Docs](https://github.com/webklex/laravel-imap)[ RSS](/packages/macromindonline-laravel-imap/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (1)Versions (23)Used By (0)

IMAP Library for Laravel
========================

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

[![Latest Version on Packagist](https://camo.githubusercontent.com/8a1edc263331e0ab34ad7554bc17744ca0b654ca957b90ec688483cbfa2e4a2f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f5765626b6c65782f6c61726176656c2d696d61702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/Webklex/laravel-imap)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/cece068b3cf5186e6baae1dcf2b550ffa1a51291136c7226fc4a00e324e17798/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f5765626b6c65782f6c61726176656c2d696d61702f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/Webklex/laravel-imap)[![Total Downloads](https://camo.githubusercontent.com/8dd8f99d06e38b388cf8a6dbd0f1a993a8e999fa9184bf49b832d2c45c987879/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f5765626b6c65782f6c61726176656c2d696d61702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/Webklex/laravel-imap)[![Gittip](https://camo.githubusercontent.com/447b651f83a733c867e8ee8884ff25ae49e1dd5ee207245f32807f4e738f7694/687474703a2f2f696d672e736869656c64732e696f2f6769747469702f7765626b6c65782e737667)](https://www.gittip.com/webklex)

Install
-------

[](#install)

Via Composer

```
$ composer require webklex/laravel-imap
```

Setup
-----

[](#setup)

Add the service provider to the providers array in config/app.php.

```
'providers' => [
    Webklex\IMAP\Providers\LaravelServiceProvider::class,
];
```

If you are planning to use a single account, you might want to add the following to your .env file.

```
IMAP_HOST=somehost.com
IMAP_PORT=993
IMAP_ENCRYPTION=ssl
IMAP_VALIDATE_CERT=true
IMAP_USERNAME=root@example.com
IMAP_PASSWORD=secret

```

The following encryption methods are supported:

```
false   - Disable encryption
ssl     - Use SSL
tls     - Use TLS

```

Publishing
----------

[](#publishing)

You can publish everything at once

```
php artisan vendor:publish --provider="Webklex\IMAP\Providers\LaravelServiceProvider"
```

Access the IMAP Client by its Facade [\\Webklex\\IMAP\\Facades\\Client::class](src/IMAP/Facades/Client.php). Therefor you might want to add an alias to the aliases array within the [config/imap.php](src/config/imap.php) file.

```
'aliases' => [
    'Client' => Webklex\IMAP\Facades\Client::class
];
```

Usage
-----

[](#usage)

This library is designed to handle the native php imap functions more easily and to be able to integrate this package within your current laravel installation.

Here 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 ben tested in real live but it gives an impression on how things work.

```
use Webklex\IMAP\Client;

$oClient = new Client([
    'host'          => 'somehost.com',
    'port'          => 993,
    'encryption'    => 'ssl',
    'validate_cert' => true,
    'username'      => 'username',
    'password'      => 'password',
]);

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

//Get all Mailboxes
$aMailboxes = $oClient->getFolders();

//Loop through every Mailbox
/** @var \Webklex\IMAP\Folder $oMailbox */
foreach($aMailboxes as $oMailbox){

    //Get all Messages of the current Mailbox
    /** @var \Webklex\IMAP\Message $oMessage */
    foreach($oMailbox->getMessages() as $oMessage){
        echo $oMessage->subject.'';
        echo 'Attachments: '.$oMessage->getAttachments()->count().'';
        echo $oMessage->getHTMLBody(true);

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

If you use the Facade [\\Webklex\\IMAP\\Facades\\Client::class](src/IMAP/Facades/Client.php) please select an account first:

```
use Webklex\IMAP\Facades\Client;

$oClient = Webklex\IMAP\Facades\Client::account('default');
$oClient->connect();
```

You can define your accounts inside the [config/imap.php](src/config/imap.php) file:

```
'accounts' => [
    'default' => [
        'host'  => env('IMAP_HOST', 'localhost'),
        'port'  => env('IMAP_PORT', 993),
        'encryption'    => env('IMAP_ENCRYPTION', 'ssl'),
        'validate_cert' => env('IMAP_VALIDATE_CERT', true),
        'username' => env('IMAP_USERNAME', 'root@example.com'),
        'password' => env('IMAP_PASSWORD', ''),
    ],
    'gmail' => [.. ]
]

```

Documentation
-------------

[](#documentation)

### [Client::class](src/IMAP/Client.php)

[](#clientclass)

MethodArgumentsReturnDescriptionsetConfigarray $configselfSet the Client configuration. Take a look at `config/imap.php` for more inspiration.getConnectionresource $connectionresourceGet the current imap resourcesetReadOnlybool $readOnlyselfSet read only property and reconnect if it's necessary.setFetchOptioninteger $optionselfFail proof setter for $fetch\_optionisReadOnlyboolDetermine if connection is in read only mode.isConnectedboolDetermine if connection was established.checkConnectionDetermine if connection was established and connect if not.connectint $attemptsConnect to server.disconnectDisconnect from server.getFoldersbool $hierarchical, string or null $parent\_folderarrayGet folders list. If hierarchical order is set to true, it will make a tree of folders, otherwise it will return flat array.openFolder\\Webklex\\IMAP\\Folder $folderOpen a given folder.createFolderstring $nameCreate a new folder.getMessages\\Webklex\\IMAP\\Folder $folder, string $criteriaarrayGet messages from folder.getUnseenMessages\\Webklex\\IMAP\\Folder $folder, string $criteriaarrayGet Unseen messages from folder.getQuotaarrayRetrieve the quota level settings, and usage statics per mailboxgetQuotaRootstring $quota\_rootarrayRetrieve the quota settings per usercountMessagesintGets the number of messages in the current mailboxcountRecentMessagesintGets the number of recent messages in current mailboxgetAlertsarrayReturns all IMAP alert messages that have occurredgetErrorsarrayReturns all of the IMAP errors that have occurredgetLastErrorstringGets the last IMAP error that occurred during this page requestexpungeboolDelete all messages marked for deletioncheckCurrentMailboxobjectCheck current mailbox### [Message::class](src/IMAP/Message.php)

[](#messageclass)

MethodArgumentsReturnDescriptiondeleteDelete the current MessagerestoreRestore a deleted Messagecopystring $mailbox, int $optionsCopy the current Messages to a mailboxmovestring $mailbox, int $optionsMove the current Messages to a mailboxmoveToFolderstring $mailboxMove the Message into an other FolderhasTextBodyCheck if the Message has a text bodyhasHTMLBodyCheck if the Message has a html bodygetTextBodystringGet the Message text bodygetHTMLBodystringGet the Message html bodygetAttachmentscollectionGet all message attachmentsgetClientClientGet the current Client instancegetUidstringGet the current UIDgetFetchOptionsstringGet the current fetch optiongetMsglistintegerGet the current message listgetMessageIdintegerGet the current message IDgetMessageNointegerGet the current message numbergetSubjectstringGet the current subjectgetDateCarbonGet the current date objectgetFromarrayGet the current from informationgetToarrayGet the current to informationgetCcarrayGet the current cc informationgetBccarrayGet the current bcc informationgetReplyToarrayGet the current reply to informationgetSenderarrayGet the current sender informationgetBodiesmixedGet the current bodies### [Folder::class](src/IMAP/Folder.php)

[](#folderclass)

MethodArgumentsReturnDescriptionhasChildrenboolDetermine if folder has children.setChildrenarray $childrenselfSet children.getMessagesstring $criteriaarrayGet messages.deleteDelete the current Mailboxmovestring $mailboxMove or Rename the current MailboxgetStatusinteger $optionsobjectReturns status information on a mailboxappendMessagestring $message, string $options, string $internal\_dateboolAppend a string message to the current mailbox### Known issues

[](#known-issues)

ErrorSolutionKerberos error: No credentials cache file found (try running kinit) (...)Uncomment "DISABLE\_AUTHENTICATOR" inside `config/imap.php`imap\_fetchbody() expects parameter 4 to be long, string given (...)Make sure that `imap.options.fetch` is a valid integerUse of undefined constant FT\_UID - assumed 'FT\_UID' (...)Please take a look at [\#14](https://github.com/Webklex/laravel-imap/issues/14) [\#30](https://github.com/Webklex/laravel-imap/issues/30)Change log
----------

[](#change-log)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Testing
-------

[](#testing)

```
$ composer test
```

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

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

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

###  Release Activity

Cadence

Every ~13 days

Total

22

Last Release

3110d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ae0f7f1f69309bec448ac224b62d1eb8d0dd6e9477097d4a502cd0f78913042e?d=identicon)[macromindonline](/maintainers/macromindonline)

---

Top Contributors

[![Webklex](https://avatars.githubusercontent.com/u/2884144?v=4)](https://github.com/Webklex "Webklex (62 commits)")[![radicalloop](https://avatars.githubusercontent.com/u/20556881?v=4)](https://github.com/radicalloop "radicalloop (6 commits)")[![dansleboby](https://avatars.githubusercontent.com/u/4716382?v=4)](https://github.com/dansleboby "dansleboby (3 commits)")[![alfonsobries](https://avatars.githubusercontent.com/u/17262776?v=4)](https://github.com/alfonsobries "alfonsobries (2 commits)")[![k9uma](https://avatars.githubusercontent.com/u/12296763?v=4)](https://github.com/k9uma "k9uma (1 commits)")[![FlashWS](https://avatars.githubusercontent.com/u/9982293?v=4)](https://github.com/FlashWS "FlashWS (1 commits)")[![parshikov](https://avatars.githubusercontent.com/u/983028?v=4)](https://github.com/parshikov "parshikov (1 commits)")

---

Tags

laravelmailimapwebklexlaravel-imap

### Embed Badge

![Health badge](/badges/macromindonline-laravel-imap/health.svg)

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

###  Alternatives

[webklex/laravel-imap

Laravel IMAP client

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

PHP IMAP client

4365.5M14](/packages/webklex-php-imap)[vemcogroup/laravel-sparkpost-driver

SparkPost driver to use with Laravel 6.x|7.x|8.x|9.x|10.x

421.7M1](/packages/vemcogroup-laravel-sparkpost-driver)[zalazdi/laravel-imap

Laravel 5 IMAP client.

5112.8k](/packages/zalazdi-laravel-imap)

PHPackages © 2026

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