All Projects β†’ tighten β†’ Mailthief

tighten / Mailthief

A fake mailer for Laravel Applications for testing mail.

Projects that are alternatives of or similar to Mailthief

Es4x
πŸš€ fast JavaScript 4 Eclipse Vert.x
Stars: ✭ 669 (-2.62%)
Mutual labels:  hacktoberfest
Laravel Cors
The laravel-cors package allows you to send Cross-Origin Resource Sharing headers with Laravel middleware configuration.
Stars: ✭ 5,916 (+761.14%)
Mutual labels:  hacktoberfest
Vscode Styled Components
Syntax highlighting for styled-components
Stars: ✭ 680 (-1.02%)
Mutual labels:  hacktoberfest
Thruster
A fast, middleware based, web framework written in Rust
Stars: ✭ 671 (-2.33%)
Mutual labels:  hacktoberfest
Deck
πŸ—‚ Kanban-style project & personal management tool for Nextcloud, similar to Trello
Stars: ✭ 675 (-1.75%)
Mutual labels:  hacktoberfest
Wallabag
wallabag is a self hostable application for saving web pages: Save and classify articles. Read them later. Freely.
Stars: ✭ 6,392 (+830.42%)
Mutual labels:  hacktoberfest
Hercules
Hercules is a collaborative software development project revolving around the creation of a robust massively multiplayer online role playing game (MMORPG) server package. Written in C, the program is very versatile and provides NPCs, warps and modifications. The project is jointly managed by a group of volunteers located around the world as well as a tremendous community providing QA and support. Hercules is a continuation of the original Athena project.
Stars: ✭ 669 (-2.62%)
Mutual labels:  hacktoberfest
Tslint To Eslint Config
Converts your TSLint configuration to the closest possible ESLint equivalent. πŸš€
Stars: ✭ 680 (-1.02%)
Mutual labels:  hacktoberfest
Fabric Sdk Node
Hyperledger Fabric SDK for Node https://wiki.hyperledger.org/display/fabric
Stars: ✭ 676 (-1.6%)
Mutual labels:  hacktoberfest
Satpy
Python package for earth-observing satellite data processing
Stars: ✭ 679 (-1.16%)
Mutual labels:  hacktoberfest
Faker
Faker is a pure Elixir library for generating fake data.
Stars: ✭ 673 (-2.04%)
Mutual labels:  hacktoberfest
Roc Toolkit
Real-time audio streaming over the network.
Stars: ✭ 673 (-2.04%)
Mutual labels:  hacktoberfest
Duf
Disk Usage/Free Utility - a better 'df' alternative
Stars: ✭ 7,240 (+953.86%)
Mutual labels:  hacktoberfest
Vue Stripe
Stripe Checkout & Elements for Vue.js
Stars: ✭ 669 (-2.62%)
Mutual labels:  hacktoberfest
Querido Diario
πŸ“° Brazilian government gazettes, accessible to everyone.
Stars: ✭ 681 (-0.87%)
Mutual labels:  hacktoberfest
Clippy
πŸ“ŽπŸ’¬πŸŽ‰ Clippy from Microsoft Office is back and runs on macOS! Written in Swift.
Stars: ✭ 670 (-2.47%)
Mutual labels:  hacktoberfest
Git Stats
πŸ€ Local git statistics including GitHub-like contributions calendars.
Stars: ✭ 5,789 (+742.65%)
Mutual labels:  hacktoberfest
Testing Nestjs
A repository to show off to the community methods of testing NestJS including Unit Tests, Integration Tests, E2E Tests, pipes, filters, interceptors, GraphQL, Mongo, TypeORM, and more!
Stars: ✭ 685 (-0.29%)
Mutual labels:  hacktoberfest
Openfoodnetwork
Connect suppliers, distributors and consumers to trade local produce. We're recruiting paid contributors, link below.
Stars: ✭ 682 (-0.73%)
Mutual labels:  hacktoberfest
Backslide
πŸ’¦ CLI tool for making HTML presentations with Remark.js using Markdown
Stars: ✭ 679 (-1.16%)
Mutual labels:  hacktoberfest

Github Actions Status MailThief Logo

MailThief

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

Note:

Due to changes in the way mail testing is handled by Laravel; MailThief is not needed for recent versions of the framework. MailThief will remain compatible with Laravel up to version 5.5.

Quickstart

Installation:

composer require tightenco/mailthief --dev

Example route:

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

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

    // <snip> Return response </snip>
});

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' => '[email protected]',
            'password' => 'secret',
        ]);

        // Check that an email was sent to this email address
        $this->seeMessageFor('[email protected]');

        // BCC addresses are included too
        $this->seeMessageFor('[email protected]');

        // 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('[email protected]');

        // 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 and Message 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. But if you’re using the classic mail syntax in any version of Laravel, MailThief is still your best option.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].