PHPackages                             kekaadrenalin/yii2-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. kekaadrenalin/yii2-imap

ActiveYii2-extension[Mail &amp; Notifications](/categories/mail)

kekaadrenalin/yii2-imap
=======================

yii2 extension to read and process mails from IMAP and PHP

0.5.8(6y ago)246.4k↓51.8%3BSD-3-ClausePHPPHP &gt;=7.0.0

Since Dec 30Pushed 2y agoCompare

[ Source](https://github.com/kekaadrenalin/yii2-imap)[ Packagist](https://packagist.org/packages/kekaadrenalin/yii2-imap)[ Docs](https://github.com/kekaadrenalin/yii2-imap.git)[ RSS](/packages/kekaadrenalin-yii2-imap/feed)WikiDiscussions master Synced today

READMEChangelog (4)Dependencies (1)Versions (10)Used By (0)

yii2 Imap
=========

[](#yii2-imap)

[![Total Downloads](https://camo.githubusercontent.com/9732def8f17b25aa94a0042f8d72706b8299ae1b25c37fc9f22a2dcd5ce413eb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6b656b61616472656e616c696e2f796969322d696d61702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/kekaadrenalin/yii2-imap)

This library is a fork of

Installation by composer
------------------------

[](#installation-by-composer)

```
{
    "require": {
       "kekaadrenalin/yii2-imap": "dev-master"
    }
}

Or

$ composer require kekaadrenalin/yii2-imap "dev-master"

```

Use as component
================

[](#use-as-component)

Connection details define in component

```
'components' => [
    ...
    'imap' => [
        'class' => 'kekaadrenalin\imap\Imap',
        'connection' => [
            'imapPath'       => '{imap.gmail.com:993/imap/ssl}INBOX',
            'imapLogin'      => 'username',
            'imapPassword'   => 'password',
            'serverEncoding' => 'encoding', // utf-8 default.
            'attachmentsDir' => '/',
            'decodeMimeStr'  => true, // Return as is, default -> true
        ],
    ],
    ...
 ],

$mailbox = new kekaadrenalin\imap\Mailbox(Yii::$app->imap->connection);
```

Usage as library
================

[](#usage-as-library)

Connection details set on fly

```
$imapConnection = new kekaadrenalin\imap\ImapConnection;

$imapConnection->imapPath = '{imap.gmail.com:993/imap/ssl}INBOX';
$imapConnection->imapLogin = 'username';
$imapConnection->imapPassword = 'password';
$imapConnection->serverEncoding = 'encoding'; // utf-8 default.
$imapConnection->attachmentsDir = '/';
$imapConnection->decodeMimeStr = true;

$mailbox = new kekaadrenalin\imap\Mailbox($imapConnection);
```

To get all mails and its index
==============================

[](#to-get-all-mails-and-its-index)

```
$mailIds = $mailbox->searchMailBox(); // Gets all Mail ids.
print_r($mailIds);
```

Do not read attachments
=======================

[](#do-not-read-attachments)

```
$mailbox->readMailParts = false;
```

To read Inbox contents
======================

[](#to-read-inbox-contents)

```
foreach($mailIds as $mailId)
{
    // Returns Mail contents
    $mail = $mailbox->getMail($mailId);

    // Read mail parts (plain body, html body and attachments
    $mailObject = $mailbox->getMailParts($mail);

    // Array with IncomingMail objects
    print_r($mailObject);

    // Returns mail attachements if any or else empty array
    $attachments = $mailObject->getAttachments();
    foreach($attachments as $attachment){
        echo ' Attachment:' . $attachment->name . PHP_EOL;

        // Delete attachment file
        unlink($attachment->filePath);
    }
}
```

To Mark and delete mail from IMAP server.
=========================================

[](#to-mark-and-delete-mail-from-imap-server)

```
$mailbox->deleteMail($mailId); // Mark a mail to delete
$mailbox->expungeDeletedMails(); // Deletes all marked mails
```

Contribute
==========

[](#contribute)

Feel free to contribute. If you have ideas for examples, add them to the repo and send in a pull request.

Appreciate
==========

[](#appreciate)

Don't forget to leave me a "star" if you like it. Enjoy coding!

###  Health Score

34

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity34

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~86 days

Recently: every ~48 days

Total

9

Last Release

2419d ago

PHP version history (2 changes)0.5.0PHP &gt;=5.4.0

0.5.5PHP &gt;=7.0.0

### Community

Maintainers

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

---

Top Contributors

[![yiioverflow](https://avatars.githubusercontent.com/u/2894563?v=4)](https://github.com/yiioverflow "yiioverflow (34 commits)")[![kekaadrenalin](https://avatars.githubusercontent.com/u/8266477?v=4)](https://github.com/kekaadrenalin "kekaadrenalin (28 commits)")[![uldisn](https://avatars.githubusercontent.com/u/3525344?v=4)](https://github.com/uldisn "uldisn (19 commits)")[![marcogermani87](https://avatars.githubusercontent.com/u/998645?v=4)](https://github.com/marcogermani87 "marcogermani87 (7 commits)")[![doctorpepper608](https://avatars.githubusercontent.com/u/2807984?v=4)](https://github.com/doctorpepper608 "doctorpepper608 (2 commits)")[![marcinmisiak](https://avatars.githubusercontent.com/u/10694258?v=4)](https://github.com/marcinmisiak "marcinmisiak (2 commits)")[![Sirgalas](https://avatars.githubusercontent.com/u/12089457?v=4)](https://github.com/Sirgalas "Sirgalas (1 commits)")[![gatis-ozols](https://avatars.githubusercontent.com/u/30055755?v=4)](https://github.com/gatis-ozols "gatis-ozols (1 commits)")

---

Tags

mailcronyii2extensionwidgetimapinbox

### Embed Badge

![Health badge](/badges/kekaadrenalin-yii2-imap/health.svg)

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

###  Alternatives

[roopz/yii2-imap

yii2 extension to read and process mails from IMAP and PHP

4098.0k](/packages/roopz-yii2-imap)[kartik-v/yii2-widget-growl

A widget to generate growl based notifications using bootstrap-growl plugin (sub repo split from yii2-widgets)

424.4M14](/packages/kartik-v-yii2-widget-growl)[boundstate/yii2-mailgun

Mailgun integration for the Yii framework

28168.1k](/packages/boundstate-yii2-mailgun)[tigrov/yii2-mailqueue

Yii2 mail queue component for yii2-swiftmailer.

196.6k](/packages/tigrov-yii2-mailqueue)

PHPackages © 2026

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