Setup MailTrap in Laravel

We get a lot of email, mail notifications from different websites on a daily basis. While implementing this feature in our websites or Laravel projects we need to test them locally in our development environment. In this scenario Mailtrap is a very useful service. Mailtrap is a fake SMTP server test. It allows developers to view, share emails sent from the development staging environments. Without sending to real users we can test email notifications from our application with MailTrap. To create an account in Mailtrap visit the link https://mailtrap.io. You can sign up using your google account or GitHub account or create a new password with your email address. You will need to create an inbox after logging in. You will get an email address to which you can send notification emails. 

                             Now you need to add MailTrap to your Laravel app by editing your .env file and adding mailtrap details.

MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=yourMailtrapUsername
MAIL_PASSWORD=yourMailtrapPassword
MAIL_ENCRYPTION=tls

Replace ‘yourMailtrapUsername’, ‘yourMailtrapPassword’ with your original Mailtrap username and password. Save your .env file. Let’s test email by sending an email from your application. Your email will appear in your Mailtrap inbox.