Laravel Test Email Functionality with MailTrap on Localhost

Send your Test Emails in your Laravel project with MailTrap…

Geno Tech
4 min readMay 31, 2023
Laravel Test Email Functionality with MailTrap on Localhost

Email sending is a crucial functionality in our websites. When you develop a Laravel project and want to send emails, Testing in the local environment is difficult. With MailTrap, we can easily test those emails before you go to production. Here are the easy steps you need to follow.

Create a MailTrap Account

First, we need to create a MailTrap account to get our free inbox to test the emails. You can easily create a MailTrap account here. https://mailtrap.io/register/signup?ref=header

You can create a new mailbox after you create a new account and log in to the MailTrap. Inside that, you can see the following screen.

Create a MailTrap Account

Here the most important is SMTP Settings. So we will use those settings under Laravel, which I have highlighted here.

Create a new Laravel Project.

composer create-project --prefer-dist laravel/laravel:^7.0 test_email

Create a new Controller.

--

--

Geno Tech
Geno Tech

Written by Geno Tech

Software Development | Data Science | AI — We write rich & meaningful content on development, technology, digital transformation & life lessons.

Responses (1)