PHPackages                             ejunker/mailthief - 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. [Testing &amp; Quality](/categories/testing)
4. /
5. ejunker/mailthief

ActiveLibrary[Testing &amp; Quality](/categories/testing)

ejunker/mailthief
=================

A fake Mailer for Laravel applications that takes the pain out of testing mail.

v0.3.18(3y ago)0888MITPHP

Since Jun 20Pushed 3y agoCompare

[ Source](https://github.com/ejunker/mailthief)[ Packagist](https://packagist.org/packages/ejunker/mailthief)[ RSS](/packages/ejunker-mailthief/feed)WikiDiscussions master Synced 6d ago

READMEChangelogDependencies (5)Versions (27)Used By (0)

[![Codeship Status for tightenco/mailthief](https://camo.githubusercontent.com/6bb54c1909790d34cc67d3dd6a24e8cc14cd3a9276acb66c1d20f8d083c00ef0/68747470733a2f2f636f6465736869702e636f6d2f70726f6a656374732f38363064323033302d316165372d303133342d613935342d3636656438363232356461302f7374617475733f6272616e63683d6d6173746572)](https://codeship.com/projects/159501)

[![MailThief Logo](https://raw.githubusercontent.com/tightenco/mailthief/master/mailthief-banner.png)](https://raw.githubusercontent.com/tightenco/mailthief/master/mailthief-banner.png)

MailThief
=========

[](#mailthief)

MailThief is a fake mailer for Laravel applications (5.0+) that makes it easy to test mail without actually sending any emails.

#### Note:

[](#note)

Forked from [tightenco/mailthief](https://github.com/tightenco/mailthief) with support for newer versions of Laravel.

Quickstart
----------

[](#quickstart)

Installation:

```
composer require tightenco/mailthief --dev
```

Example route:

```
Route::post('register', function () {
    //  Validation, create account, etc.

    Mail::send('emails.welcome', [], function ($m) {
        $email = request('email');
        $m->to($email);
        $m->subject('Welcome to my app!');
        $m->from('noreply@example.com');
        $m->bcc('notifications@example.com');
        $m->getHeaders()->addTextHeader('X-MailThief-Variables', 'mailthief');
    });

    //  Return response
});
```

If you're copying this sample test, remember to create an email view at `resources/views/emails/welcome.blade.php`.

Example test:

```
use MailThief\Testing\InteractsWithMail;

class RegistrationTest extends TestCase
{
    // Provides convenient testing traits and initializes MailThief
    use InteractsWithMail;

    public function test_new_users_are_sent_a_welcome_email()
    {
        $this->post('register', [
            'name' => 'John Doe',
            'email' => 'john@example.com',
            'password' => 'secret',
        ]);

        // Check that an email was sent to this email address
        $this->seeMessageFor('john@example.com');

        // BCC addresses are included too
        $this->seeMessageFor('notifications@example.com');

        // Make sure the email has the correct subject
        $this->seeMessageWithSubject('Welcome to my app!');

        // Make sure the email was sent from the correct address
        $this->seeMessageFrom('noreply@example.com');

        // Make sure a given header is set on an email
        $this->seeHeaders('X-MailThief-Variables');

        // Make sure the header is set to a given value
        $this->seeHeaders('X-MailThief-Variables', 'mailthief');

        // Make sure the email contains text in the body of the message
        // Default is to search the html rendered view
        $this->assertTrue($this->lastMessage()->contains('Some text in the message'));
        // To search in the raw text
        $this->assertTrue($this->lastMessage()->contains('Some text in the message', 'raw'));
    }
}
```

MailThief supports just about everything you can do with the regular Laravel `Mailer` and `Message` classes. More detailed documentation is coming soon, but in the mean time, explore the [MailThief](https://github.com/tightenco/mailthief/blob/master/src/MailThief.php) and [Message](https://github.com/tightenco/mailthief/blob/master/src/Message.php) classes to get an idea of what's available.

If you’re using the new Mailables syntax in Laravel 5.3, you can use the [native mail assertions](https://laravel.com/docs/master/mocking#mail-fake). But if you’re using the classic mail syntax in any version of Laravel, MailThief is still your best option.

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor3

3 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 ~103 days

Recently: every ~470 days

Total

25

Last Release

1138d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/94f5faf8e6d32349cbaf2ebf6cd84b0eb2565f44f3429950f0b06d626ef315bd?d=identicon)[ejunker](/maintainers/ejunker)

---

Top Contributors

[![mattstauffer](https://avatars.githubusercontent.com/u/151829?v=4)](https://github.com/mattstauffer "mattstauffer (26 commits)")[![adamwathan](https://avatars.githubusercontent.com/u/4323180?v=4)](https://github.com/adamwathan "adamwathan (15 commits)")[![calebporzio](https://avatars.githubusercontent.com/u/3670578?v=4)](https://github.com/calebporzio "calebporzio (15 commits)")[![besologic](https://avatars.githubusercontent.com/u/122173?v=4)](https://github.com/besologic "besologic (14 commits)")[![ejunker](https://avatars.githubusercontent.com/u/4758?v=4)](https://github.com/ejunker "ejunker (5 commits)")[![wells](https://avatars.githubusercontent.com/u/2041871?v=4)](https://github.com/wells "wells (3 commits)")[![JayBizzle](https://avatars.githubusercontent.com/u/340752?v=4)](https://github.com/JayBizzle "JayBizzle (3 commits)")[![korygorsky](https://avatars.githubusercontent.com/u/1092915?v=4)](https://github.com/korygorsky "korygorsky (3 commits)")[![ksassnowski](https://avatars.githubusercontent.com/u/5139098?v=4)](https://github.com/ksassnowski "ksassnowski (3 commits)")[![MarkVaughn](https://avatars.githubusercontent.com/u/39970?v=4)](https://github.com/MarkVaughn "MarkVaughn (3 commits)")[![jwalton512](https://avatars.githubusercontent.com/u/1199655?v=4)](https://github.com/jwalton512 "jwalton512 (2 commits)")[![pascalbaljet](https://avatars.githubusercontent.com/u/8403149?v=4)](https://github.com/pascalbaljet "pascalbaljet (2 commits)")[![mtmail](https://avatars.githubusercontent.com/u/3727288?v=4)](https://github.com/mtmail "mtmail (1 commits)")[![ThibaudDauce](https://avatars.githubusercontent.com/u/1770543?v=4)](https://github.com/ThibaudDauce "ThibaudDauce (1 commits)")[![alepeino](https://avatars.githubusercontent.com/u/5054081?v=4)](https://github.com/alepeino "alepeino (1 commits)")[![colonelpopcorn](https://avatars.githubusercontent.com/u/13068221?v=4)](https://github.com/colonelpopcorn "colonelpopcorn (1 commits)")[![mcordingley](https://avatars.githubusercontent.com/u/1084253?v=4)](https://github.com/mcordingley "mcordingley (1 commits)")[![davidhemphill](https://avatars.githubusercontent.com/u/58970?v=4)](https://github.com/davidhemphill "davidhemphill (1 commits)")[![exls](https://avatars.githubusercontent.com/u/6387671?v=4)](https://github.com/exls "exls (1 commits)")[![freekmurze](https://avatars.githubusercontent.com/u/483853?v=4)](https://github.com/freekmurze "freekmurze (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ejunker-mailthief/health.svg)

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

###  Alternatives

[phpspec/prophecy

Highly opinionated mocking framework for PHP 5.3+

8.5k551.7M682](/packages/phpspec-prophecy)[brianium/paratest

Parallel testing for PHP

2.5k118.8M754](/packages/brianium-paratest)[tomasvotruba/bladestan

PHPStan rule for static analysis of Blade templates

363584.5k4](/packages/tomasvotruba-bladestan)[pdepend/pdepend

Official version of pdepend to be handled with Composer

954110.9M815](/packages/pdepend-pdepend)[instaclick/php-webdriver

PHP WebDriver for Selenium 2

43761.8M22](/packages/instaclick-php-webdriver)[spatie/laravel-mail-preview

A mail driver to quickly preview mail

1.3k419.3k5](/packages/spatie-laravel-mail-preview)

PHPackages © 2026

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