tomi0/mailhog-api-testing

Mailhog testing api.

3.0.0 2024-03-28 09:34 UTC

This package is not auto-updated.

Last update: 2024-04-25 10:00:07 UTC


README

Test that your emails are sent

Install

composer require tomi0/mailhog-api-testing

Usage

Use Mailhog testing trait in your test:

use Mailhog\MailhogTesting;

class ClassName {
    use MailhogTesting;
    ...
}

Set up environment:

$this->setUpMailhogEnviroment($host, $smtpPort, $webPort, $isHttps);

Available methods:

// Check if message exsits (return bool)
$this->messageExistsByContent($content);
$this->messageExists($content);

// Get all messages (return EmailMessage[])
$this->getAllMessages();

// Clear inbox (return bool)
$this->clearInbox();
$this->emptyInbox();