Code for the blog post: How to create a custom HTTP mail driver for Laravel 7+.
composer install
php artisan key:generate
Create a mock API to send emails to. See How to create a Postman Mock API.
Copy the example .env.example
:
cp .env.example
Set the CUSTOM_MAIL_URL
value:
CUSTOM_MAIL_URL="<your mock API URL>"
Start server with:
php artisan serve
Visit http://127.0.0.1:8000/email to send an email.
Run:
./vendor/bin/phpunit