How to set up Mailtrap for AdonisJS

Mailtrap is an email delivery platform to test, send, and control the email infrastructure performance. Mailtrap email testing is a fake SMTP server that comes in handy when catching test emails sent during development and staging.

Follow the steps below to set up Mailtrap for an AdonisJSAdonisJS is an open-source, Node.js-based web application framework allowing developers to build efficient, scalable, and maintainable applications using an MVC architecture pattern. application.

1. Create an account

To create an account, go to https://mailtrap.io.

After you log in successfully, the following homepage will appear:

The homepage

Next, click on the “Start Testing” button under “Email Testing”. The following will appear:

The SMTP settings

Then, click on “Show Credentials” and copy the username and password.

View credentials

2. Update .env file

Add the following to the .env file of your application:

MAIL_CONNECTION=smtp
SMTP_HOST=smtp.mailtrap.io
MAIL_USERNAME= // Username goes here
MAIL_PASSWORD= // Password goes here

Paste your Mailtrap username and password you copied earlier in front of MAIL_USERNAME and MAIL_PASSWORD, respectively. Save the .env file and try to send an email from the AdonisJS application. The email should appear in your Mailtrap email testing inboxes.

Copyright ©2024 Educative, Inc. All rights reserved