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

AbandonedLibrary

bigpaulie/imap
==============

A PHP wrapper class for PHP's IMAP-related email handling functions.

0451PHP

Since Jul 5Pushed 7y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

Imap
====

[](#imap)

This library is an improvement of [Jeff Geerling's](https://github.com/geerlingguy/Imap) project tailored specifically for my needs at the moment.

Keep in mind that this is still a work in progress so radical changes may occurr in time.

Installation
------------

[](#installation)

You can install this library via composer by running the command bellow or you can clone the repository.

```
composer require bigpaulie/imap
```

Usage
-----

[](#usage)

**A mailbox in the context of this library is referring to a directory of your email account.**

Connect to an IMAP account by creating a new Imap object with the required parameters:

```
$host = 'imap.example.com';
$user = 'johndoe';
$pass = '12345';
$port = 993;
$ssl = true;
$folder = 'INBOX';
$server = new Imap($host, $user, $pass, $port, $ssl, $folder);
```

##### Obtain a mailbox object

[](#obtain-a-mailbox-object)

```
/** @var Mailbox $mailbox */
$mailbox = $server->getMailbox();
```

If you want to access another directory

```
/** @var Mailbox $mailbox */
$mailbox = $server->getMailbox('SPAM');
```

##### Mailbox info

[](#mailbox-info)

```
/** @var array $info */
$info = $mailbox->getInfo();
```

##### Obtain a list of messages within a specific mailbox

[](#obtain-a-list-of-messages-within-a-specific-mailbox)

```
/** @var Message[] $messages */
$messages = $mailbox->getMessages();
```

You can then iterate through the array of messages

```
/** @var Message $message */
foreach ($messages as $message) {
    $subject = $message->getSubject();
    $messageBody = $message->getBody();
}
```

##### Create a search criteria

[](#create-a-search-criteria)

You can obtain only certain messages if you want to.

Only undeleted messages

```
/** @var Search $criteria */
$criteria = new Search();
$criteria->setCriteria(Search::UNDELETED);

/** @var Message[] $messages */
$messages = $mailbox->getMessages($criteria);
```

You can add multiple search criterias for example :

```
/** @var Search $criteria */
$criteria = new Search();
$criteria->setCriteria(Search::UNDELETED);
$criteria->setCriteria(Search::FROM, "John Doe");
$criteria->setCriteria(Search::KEYWORD, "candy");

/** @var Message[] $messages */
$messages = $mailbox->getMessages($criteria);
```

Search criterias can be chained together:

```
/** @var Search $criteria */
$criteria = new Search();
$criteria->setCriteria(Search::UNDELETED)
    ->setCriteria(Search::FROM, "John Doe")
    ->setCriteria(Search::KEYWORD, "candy");

/** @var Message[] $messages */
$messages = $mailbox->getMessages($criteria);
```

##### Moving messages

[](#moving-messages)

You can move messages from one mailbox to another very easily

```
if ($mailbox->moveMessage($message, 'SPAM')) {
    echo "Message moved successfuly";
}
```

##### Copying messages

[](#copying-messages)

Copying messages is as easy as moving them

```
if ($mailbox->copyMessage($message, 'SPAM')) {
    echo "Message moved successfuly";
}
```

##### Deleting messages

[](#deleting-messages)

```
$mailbox->deleteMessage($message);
```

##### Disconnecting from the server

[](#disconnecting-from-the-server)

```
$server->disconnect();
```

### Contributions

[](#contributions)

If you want to make a contribution and improve the library or you noticed a bug you are more than welcome to do so.

For contributors just fork, code and submit a pull request.

**Please maintain the coding style and testing patterns.**

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 54.5% 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/1706d209e8e01305b6823045fac6d363e149abd14a4bd20397d237ea1107a2b4?d=identicon)[bigpaulie](/maintainers/bigpaulie)

---

Top Contributors

[![geerlingguy](https://avatars.githubusercontent.com/u/481677?v=4)](https://github.com/geerlingguy "geerlingguy (36 commits)")[![bigpaulie](https://avatars.githubusercontent.com/u/5903753?v=4)](https://github.com/bigpaulie "bigpaulie (29 commits)")[![andreisusanu](https://avatars.githubusercontent.com/u/2534555?v=4)](https://github.com/andreisusanu "andreisusanu (1 commits)")

### Embed Badge

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

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

PHPackages © 2026

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