bpedroza/laravel-mail-assertions

Make assertions on mail in laravel.
4,257 3
Install
composer require bpedroza/laravel-mail-assertions
Latest Version:v0.1.12
PHP:^7.2|^8.0.0
License:MIT
Last Updated:Dec 23, 2024
Links: GitHub  ·  Packagist
Maintainer: bpedroza

Build Status

Laravel Mail Assertions

Make assertions on emails in Laravel 6 - 11

This is a simple package to allow you to make assertions on emails sent with laravel.

This package is inspired by tightenco/mailthief which I used pre laravel 6. Now that package is no longer supported, so I made this one to allow me to migrate without too much hassle.

Installation

composer require bpedroza/laravel-mail-assertions --dev

Usage

First you will need to include the Bpedroza\LaravelMailAssertions\MakesMailAssertions trait in your test.

Next you can start making assertions on emails:

Method Description
assertEmailNotSent Assert no emails were sent
assertEmailSent Assert an email was sent
assertEmailSentFrom Assert an email was sent from a given email address
assertEmailSentTo Assert an email was sent to a given address
assertEmailSentWithSubject Assert an email was sent with a given subject
assertLastEmailContains Assert the last email sent contains a given string

Related Packages

larablocks/pigeon

A more flexible email message builder for Laravel 5 including chained methods, r...

3,706 14
sun/sunmailer

SunMailer helps you to send email easily.

454 3
coconutcraig/laravel-postmark

Laravel package for sending mail via the Postmark API

3,556,147 218
ritey/mailgun

A laravel 5 wrapper for sending mail via the Mailgun API in Laravel style

25 1
puz/mail_autoembed

Automatically embed all image sources in your emails

22 14