Getting Started Guide

All you need to start using Mailtrap efficiently is here! Learn how it helps you to test emails in a safe and easy way. Quickly set up Mailtrap, understand its functionality and the main use cases.

Welcome to Mailtrap

In this article

We are happy to welcome you as a Mailtrap user! 
Mailtrap is a service for the safe testing of emails sent from the development and staging environments. Mailtrap catches your emails in a virtual inbox so that you can test and optimize your email campaigns before sending them to real users. 

Watch how Mailtrap works

Learn how exactly Mailtrap can help you streamline email testing processes from our case study with The Software House.

How to send a test email to Mailtrap

There are three ways to integrate Mailtrap into your email infrastructure. First of all, log into your Mailtrap account - you will immediately be redirected to the main page. There you will see a list of Projects (they work similarly to folders) and Inboxes (they are like subfolders in Projects). 

 Once you’ve logged in to your account for the first time, you will be redirected to My Inbox.

Tip: We have already created an inbox for you. By default, it’s named "My Inbox", located in the "My Inboxes" project. You can easily rename them both with the Edit action button.

Option 1. Paste a few lines of code to your app script 

In the SMTP Settings tab, select your framework from the list of integrations, copy the code sample, and simply paste it into your email sending script. 

The sample contains the Mailtrap hostname, port number, and your username and password. 

Tip: each Mailtrap inbox has its own SMTP/POP3 server credentials. You can reset them any time you need. Username and password are unique for each inbox. For your security, please avoid sharing them publicly. 

Option 2. Paste SMTP credentials to your app script / MTA/ other settings 

In the  SMTP Settings tab, click the Show credentials link. 
Copy SMTP credentials:
  •  Host: smtp.mailtrap.io
  •   Port: 25 or 465 or 587 or 2525
  •   Username: unique for each inbox
  •   Password: unique for each inbox 

Paste the credentials to your email sending script, MTA settings, email client settings - any system that supports SMTP credentials. 
Tip: each Mailtrap inbox has its own SMTP/POP3 server credentials. You can reset them any time you need. Username and password are unique for each inbox. For your security, please avoid sharing them publicly. 

Option 3. Use the email address of your Mailtrap inbox 

Every inbox has its own dedicated email address.  This feature is available starting from the Business plan.
You can use it like any other email address to send messages from your email client or an email sending service to your Mailtrap inbox. Go to the Email Address tab and select Enable from the three dots menu next to the inbox address to activate it. 

Tip: The email address is customizable. It consists of two parts: 1- a descriptive part that you can adjust (dynamic aliases such as +1 are supported); 2- A Mailtrap tech hash (6 digits) that can't be changed as it is used as an identifier for each inbox. This means that messages sent to test1-12ab34@inbox.mailtrap.io  and test1+1-12ab34@inbox.mailtrap.io will be delivered to one and the same inbox.
For any method you choose, after executing the "Send" command, you should instantly receive the message in your Mailtrap inbox.
This way, you have verified that email sending is functioning properly. It’s perfectly simple, isn’t it? Besides, other Mailtrap users can share their inboxes with you. If they do, you will find them on the homepage.  
Tip: You can also share your inbox with anyone, but this option is available starting from the Team plan. Go to the “Collaborate with teammates and clients” section below to get more details.

What else can you do with Mailtrap?

Perhaps you need to quickly check whether your application is sending emails correctly. Or most likely, you would like to view how your messages display and perform. Mailtrap offers multiple helpful options for email testing and debugging. 

View your email in HTML or Raw format

View how your message is rendered. Go to the HTML tab in the message menu. It opens by default when you select the message in your inbox. This tab shows how the email is rendered by a web browser. Check whether images are displayed, links are correct, variables are generated properly, and read the content of your message. 

Check the email template for responsiveness. In the same HTML tab,  you can also view how the message is displayed on a desktop, tablet, or smartphone. Use the icons in the HTML tab to perform these checks, or open the message in a new browser tab.
To view the HTML markup, check out the HTML Source tab. It is important that HTML messages have both HTML and text parts because this affects the spam score. The text part allows a recipient to be able to read the message when the recipient cannot display HTML for some reason. To view the text part, check the Text tab. 
Additionally, you can view the raw email data (as received from the SMTP relay) in the Raw tab. If the raw data exceeds 300 KB, you will be prompted to download it as a .eml file.
You can access any of these views from the message tabs, or open them in a new tab from the Message menu under the three dots in the top-right corner. 

Find and fix template errors

Email clients use different rendering standards. This is why your email can be displayed not as you designed it. You need to check that your message code won't cause rendering issues. 

Mailtrap’s HTML Check scans through your email in search of problematic elements. For each it finds, it displays the list of email clients that lack support for it or support it only partially. It also estimates the support for your emails’ code across popular email clients, making adjustments for their popularity. 

Go to the Check HTML tab to see the report:

HTML Check collects the list of rules used in your email and compiles it with the support data we have for the most popular email clients. The final result is the Market Support - the overall level of HTML/CSS support for your email.

Below you will see a list of rules that cause errors in the specified email clients. To the right of each element, you can see the numbers ([1], [2], etc.). Click on any of them, and the “show more” section will expand, explaining what the issue is and which client/version it applies to. 

Clicking on the line number will take you to the  HTML Source tab where you can view your email’s entire HTML. 

View emails in real inboxes

If you need to check how your message will be displayed in a specific email client, or your customer asks you to demonstrate the results of your work, you can forward any message to a real user’s inbox, manually or automatically. 
Email forwarding is available starting from the Individual billing plan. 
Please note that verification is needed to prevent Mailtrap usage for spam and fraud!
To forward a message from your inbox, go to the corresponding inbox menu. In the Manual Forward tab, enter the email address where you wish to send your message, and click  Add Email.
After that, the selected email recipient will get a request to confirm receipt of your forwarded messages. If agreed, this email address will appear in the “Manual Forwarded Emails” list.
Now you can choose any email from your inbox and forward it to the confirmed email address by clicking the Forward email icon in the message menu.
To improve your user experience and expand collaboration options, Mailtrap allows you to automatically forward all caught messages to the real email addresses and domains. In the Auto Forward tab, you can create a list of rules for automatic forwarding. Enter an email address or domain value in the appropriate field, then click the Add Email or Add Domain button. Once those emails and/or domains are verified, all messages will be automatically forwarded from this inbox according to the specified rules.
The number of emails you can forward depends on your current billing plan.

Check deliverability

In the Spam  Analysis tab, you will find the results of Spam and Blacklist reports. 
The Spam report provides you with an overall score and explanation of whether you need to take any actions. It also has a detailed description of each rule that can be treated as suspicious by email clients.
Mailtrap also checks whether the sender's IP or domain (specified in the "To" field) has been listed on any of the commonly used blacklists. It shows resources that have been queried and the result in a Blacklist report

Test Bcc and email headers

It is especially important to carefully check email headers such as To, From, and Cc. You need to be sure that the sender and recipients are generated correctly and can't cause any trouble.
Press the Show headers link in the main message menu or select the  Tech Info tab. 
Usually, it's far more difficult to check Bcc than regular email headers. But you can easily test and debug Bcc email addresses with Mailtrap (available starting from the Team plan). If the message you sent to Mailtrap contains Bcc’ed recipients, you will be able to see them along with the message headers (From, To, Cc). Bcc won’t be displayed in a real email! Mailtrap analyzes SMTP commands of the message, compares message headers and recipients, and then prints out the difference to the Bcc field for your convenience. 
You will see the detailed list of email addresses used in this message (in MAIL and RCPT TO commands) in the Tech info tab.
For details of the billing plans, follow this link or press the Upgrade button in your account.

Collaborate with teammates and clients

To invite your teammates (or anyone you wish) to work together on debugging your emails, Mailtrap offers the Team Members feature. With it, you can  share your inboxes with other users, as well as invite new members to collaborate within a project. This feature is available starting from the Team plan. 
To share an inbox, go to the Team members tab in the settings of your inbox. Enter an email address and click the Add Member button. This user will gain full access to your inbox and all the messages within (after confirming your request by email). If this address is not yet registered in Mailtrap, its owner will first be asked to create a free account.
Your team members will find this inbox on the home page. To share all inboxes grouped in the project, click the Project Team Members link in the Team Members tab. There you can enter email addresses to send the invitation by email, or get a shareable link.
In the same tab, you also can review and edit the list of the Project Team Members as well as monitor their status (pending, user, or owner).
Otherwise, you can go to your home page and select the Team Members option from the three-dots menu next to the Project name. 

Carefully organize data

To keep everything in order and be able to easily find or share necessary data, set up a new inbox for each test server, and group them into Projects.
Your inbox is already a part of a Project (“My Inboxes”, by default). To customize it, go to your Mailtrap home page and select the three-dots menu next to the Project name. You can also delete the project by clicking the Delete icon. Keep in mind that if you delete your project, all inboxes inside it will be also removed.
The number of inboxes and projects you can create depends on your current billing plan.

Automate testing with APIs

You can automate your testing process with our Mailtrap API. Go to your account menu on the Home page, and select API
There you will get your API token, link to API Docs, and will be able to specify a list of domains, which will have access to API via CORS.
The Mailtrap API uses the REST protocol, and can return calls in JSON or XML data formats.
To get more information and examples, go to Mailtrap API Documentation

Learn how you can easily test various user scenarios with a ready to use integration of Kakunin (E2E testing framework) + Mailtrap from our case study with The Software House.

Still need help? Contact Us Contact Us