Replit
Replit is a tool that lets you build and deploy software using AI without any coding whatsoever. In this article, you’ll learn how to connect it to Mailtrap and add email-sending functionality to your projects.
Prerequisites:
Add and verify your email sending domain since Mailtrap allows you to send emails only from a verified domain.
Make sure your API Token has
adminaccess level to that domain.
Step 1. Add your Mailtrap credentials
The Mailtrap credentials you need to add to Replit include:
MAILTRAP_API_TOKEN– This is the Mailtrap API token, which you can create at any time from your account.MAILTRAP_FROM_EMAIL– This is the email address with the verified Mailtrap sending domain you’ve added after creating an account.
To add these, open your Replit project, click on Tools & files, and navigate to the Secrets tab. Then, click on New Secret and add your secrets, just like so:

Next, prompt the AI to use the secrets you just added so it can start sending emails from your projects using the Mailtrap email API. For this, you can use a prompt like this one:
Please use Mailtrap email API for sending emails from my project. I’ve added the following secrets: MAILTRAP_FROM_EMAIL and MAILTRAP_TOKEN
The AI will then go over Mailtrap Email API documentation, connect it to your project, and confirm once it’s done.
Step 2. Start sending emails
Once you add your credentials, try sending an email from your project. If you followed everything thus far, you should receive the email in your inbox in a few seconds.
Here it is in a Gmail inbox I used as my to address:

And here it is in the Mailtrap Email Logs:

Next steps
Use Mailtrap Templates to send branded emails with variables.
Configure Mailtrap Contacts to push user information to your Mailtrap Lists, so you can later send campaigns to them or use Automations.
Add automation triggers in Mailtrap to send follow-ups to new contacts.
Track open and click rates with Mailtrap Analytics.
Last updated
Was this helpful?

