PHPackages                             k3roulas/email-watcher - 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. k3roulas/email-watcher

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

k3roulas/email-watcher
======================

Email watcher : trig an action on a new email (protocol pop3, imap)

0.1.1(10y ago)0101MITPHPPHP &gt;=5.3.0

Since Sep 16Pushed 10y ago1 watchersCompare

[ Source](https://github.com/k3roulas/email-watcher)[ Packagist](https://packagist.org/packages/k3roulas/email-watcher)[ Docs](http://github.com/k3roulas/email-watcher)[ RSS](/packages/k3roulas-email-watcher/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (3)Versions (3)Used By (0)

Email Watcher
=============

[](#email-watcher)

Trig an action on a new email (protcol pop3, imap)

\##Installation

Via composer

```
composer require k3roulas/email-watcher

```

Beware that there is a dependancy to the package tedivm/fetch

You need to install the module php5-imap.

On ubuntu :

```
apt-get install php5-imap
php5enmod imap

```

\##Usage

After installing the library, you should test it with the builtin NewEmailWatcherDump.

Once you have validated that your application communicate with your email server, implement the interface NewEmailWatcherInterface and use your own class instead of NewEmailWatcherDump. See example below.

Gmail
-----

[](#gmail)

Using a gmail account, you will have to enable pop3 or imap. Make an attempt. Wait for an security alert that you will receive on your email. Follow the instruction. You will may have to set the option "app less secure" :

\##Example

```
// example with a gmail account
$port = 993;
$email = 'bob@sinclar.dance';
$password = 'IAmNotDavidGuetta';
$filename = './lastuid.json';
$server = 'imap.gmail.com';

// Nominal usage
$newEmailWatcher = new \K3roulas\EmailWatcher\NewEmailWatcherDump();

$emailWatcher = new \K3roulas\EmailWatcher\Watcher();
$emailWatcher->setServer($server)
    ->setPort($port)
    ->setEmail($email)
    ->setPassword($password)
    ->setFilename($filename)
    ->setProtocol('imap')
    ->setNewEmailWatcher($newEmailWatcher)
    ->init();

$emailWatcher->process();

// Use another persitence service : Create your own class that implement LastUidPersistInterface
$lastUidPersist = new MyPersitenceService();
$newEmailWatcher = new \K3roulas\EmailWatcher\NewEmailWatcherDump();

$emailWatcher = new \K3roulas\EmailWatcher\Watcher();
$emailWatcher->setServer($server)
    ->setPort($port)
    ->setEmail($email)
    ->setPassword($password)
    ->setProtocol('imap')
    ->setNewEmailWatcher($newEmailWatcher)
    ->setLastUidPersist($lastUidPersist)
    ->init();

$emailWatcher->process();

// You need more complicated options to access to the server @see Fetch/Server package

$fetchServer = new \Fetch\Server($server, $port);
// For example if you use GSSAPI or  NTLM
$fetchServer->setAuthentication($email, $password, false);

$newEmailWatcher = new \K3roulas\EmailWatcher\NewEmailWatcherDump();

$emailWatcher = new \K3roulas\EmailWatcher\Watcher();
$emailWatcher->setFetchServer($fetchServer)
    ->setNewEmailWatcher($newEmailWatcher)
    ->setFilename($filename)
    ->init();

$emailWatcher->process();
```

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~0 days

Total

2

Last Release

3943d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2f25f315794017d61b51f42e572491f5fcbf335bc12798987589f453aa2e5261?d=identicon)[k3roulas](/maintainers/k3roulas)

---

Top Contributors

[![k3roulas](https://avatars.githubusercontent.com/u/5458127?v=4)](https://github.com/k3roulas "k3roulas (20 commits)")

---

Tags

emailtriggerwatcherimappop3

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/k3roulas-email-watcher/health.svg)

```
[![Health](https://phpackages.com/badges/k3roulas-email-watcher/health.svg)](https://phpackages.com/packages/k3roulas-email-watcher)
```

###  Alternatives

[php-imap/php-imap

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

1.7k13.4M52](/packages/php-imap-php-imap)[tedivm/fetch

A PHP IMAP Library

5171.2M8](/packages/tedivm-fetch)[ddeboer/imap

Object-oriented IMAP for PHP

9364.1M15](/packages/ddeboer-imap)[webklex/php-imap

PHP IMAP client

4466.7M27](/packages/webklex-php-imap)[benhall14/php-imap-reader

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

3519.6k](/packages/benhall14-php-imap-reader)[tedivm/dovecottesting

An IMAP Testing Suite

312.4k7](/packages/tedivm-dovecottesting)

PHPackages © 2026

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