E-mail Roundtrip monitor package

0.1 2017-02-08 10:58 UTC

This package is not auto-updated.

Last update: 2020-09-18 21:19:51 UTC


Simple PHP email round trip monitoring tool.

Has IMAP support for validating that e-mails are received.

The test e-mails should be sent through the e-mail method that is usual used in your project (passed as a callback function).


composer require kristiani/email-roundtrip-monitor


You would like your set-up to consist of two cron jobs

  1. The cron that sends a test e-mail. The cron can be run e.g. every 15 minutes.

  2. The cron that checks the test e-mail is received within an tolerated interval. The cron can be run e.g. every 5 minutes. It's convenient to let a 3rd party service (e.g. pull this check instead of a local cron.

Sending cron

\Roundtripmonitor\Config::$receiverEmail = '';

\Roundtripmonitor\Send::email(function($toName, $toEmail, $fromName, $fromEmail, $subject, $body) {
    yourEmailFunction($toName, $toEmail, $fromName, $fromEmail, $subject, $body);

Receiving cron

If you would like your receiving cron to return status code 500 on failure:

\Roundtripmonitor\Config::server('', 143, 'imapUsername', 'imapPassword', 'INBOX');

If you prefer to handle your exceptions by yourself:

try {
    \Roundtripmonitor\Config::server('', 143, 'imapUsername', 'imapPassword', 'INBOX');
} catch (\Exception $ex) {
    // do something about it

Change settings

You can change all settings in Config.php individually, e.g.

\Roundtripmonitor\Config::$alertThresholdTime = 900;