Faker Mail – Setup mail sending using mailtrap for Laravel

If you’re looking to send emails from your application, Mailgun is a good option to go with, but it is not available for local development. For the purpose of application testing and development, Mailtrap is the right choice to go with. In this article, I will show you how to setup mailtrap for your Laravel application. Faker Mail – Setup mail sending using mailtrap for Laravel.

If you’re looking to send actual mails using Mailgun for a production app, checkout this tutorial where I have discuss in dept a step by step guide. Email Sending – How to setup Mailgun for Laravel 8

Step One: Create and setup an account on Mailtrap

  • Visit mailtrap.io to create your acount
  • Click on add inbox
  • Enter inbox name
  • Click on save

You can create multiple inbox if you subscribe to mailtrap services.

Step Two: Get Mailtrap Inbox Settings

Click on the Settings icon next to your inbox

Get Mailtrap Inbox Settings

Change Integrations from cUrl to Laravel 7+

Get your mailtrap integrations settings

Copy the SMTP settings displayed

Mailtrap smtp settings

Step Three: Adding these settings to our Laravel App

Open the .env file in your Laravel application and replace this values with the once you’ve copied from mailtrap inbox settings. Go through the file and find each line, delete and replace the value

MAIL_USERNAME=username generated from mailtrap
MAIL_PASSWORD=password generated from mailtrap

That’s it, you’ve successfully integrated mailtrap into your application for faker mail sending. To try out this feature, try using the password reset feature provided out of the box by Laravel Breeze. If you’ve not set up authentication using Laravel breeze yet, check out this tutorial on how to do so:


1 thought on “Faker Mail – Setup mail sending using mailtrap for Laravel”

Leave a Comment

%d bloggers like this: