Getting Started Guide
Welcome to Mailtrap
In this article
- Email Testing
- How to send a test email to Mailtrap Email Testing
- What else you can do with Mailtrap Email Testing
- Automate testing with Email Testing API
- Mailtrap Email Sending (API / SMTP)
- How to integrate Mailtrap Email Sending (API/SMTP)
- What else you can do with Mailtrap Email Sending
- Control production emails with Actionable Analytics
Mailtrap Email Delivery Platform is an end-to-end solution for businesses and individuals to Test, Send, and Control their emails.
Use Email Testing for secure email analysis in sandbox. Catch testing emails from staging. Preview and analyze content for spam and validate HTML/CSS before sending emails to recipients’ inboxes.
Tip: By default, we created an inbox for you and called it "My Inbox" (It’s under the My Inboxes project). The Edit button allows you to rename either a project or an inbox.
Use Email Sending (API/SMTP) to send emails to recipients’ inboxes on production. Mailtrap also gives you more control over email deliverability. For further information check:
Now, we're ready to welcome you as a Mailtrap user!
As mentioned, use Email Testing to safely test your emails in staging, then move to production with our Email Sending.
This guide gives tips and tricks on getting started and making the best of Email Testing and Email Sending.
How to send a test email to Mailtrap Email Testing
There are three ways to do it.
Option 1. Paste a few lines of code to your app script
In the SMTP Settings tab, select a framework from the list of integrations, copy the code sample, then paste it into your email-sending script.
The sample contains the Mailtrap hostname, port number, and username and password.
- Each Mailtrap inbox has its SMTP/POP3 server credentials and you can reset them anytime.
- Username and password are unique for each inbox. For your security, please avoid sharing them publicly.
- You access SMTP settings by clicking the gear icon on the far right of the “My Inbox” menu or the inbox name, as shown below.
Option 2. Paste SMTP credentials to your app script, MTA, etc.
- 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, or any system that supports SMTP credentials.
Option 3. Use the email address of your Mailtrap inbox
Starting from the Business plan, every inbox has a dedicated email address. Go to the Email Address tab and select Enable from the three dots menu next to the inbox address to activate it.
For more information on how to customize the email address check our Email address per inbox article.
Regardless of the test method, you might choose, after executing the "Send" command, you should instantly receive the message in your Mailtrap inbox. This way, you have verified that the Email Testing is functioning properly.
Tip: Starting from the Team plan, you can also share your inbox with anyone. To see all your inboxes, switch between accounts in the top right menu.
What else you can do with Mailtrap Email Testing
HTML or RAW format preview
Go to the HTML tab in the message menu to view how your message is rendered. It opens by default when you select the message in your inbox. The tab shows how the email is rendered by a web browser. Check if images are displayed, links are correct, variables are generated properly, and read the content of your message.
You can also check the email template for responsiveness and view how the message is displayed on a smartphone, tablet, or desktop (use the icons in the HTML tab).
To view the HTML markup, check 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 read the message when the recipient cannot display HTML for some reason. To view the text part, check the Text tab.
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
Most emails are HTML. So the more elements you add to an email, there’s more HTML, and the higher the chances your email won’t look the same across different email clients.
Mailtrap’s HTML Check scans through your email in search of problematic elements. For each it finds, HTML Check displays the list of email clients that don’t support it or support the element only partially. It also estimates the support for your email code across popular email clients and provides you with the percentage of the market share accordingly.
Go to the HTML Check tab to see the report:
Clicking on the line number takes you to the HTML Source tab to view your email’s entire HTML.
For more information on HTML Check, go to this article.
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.
Check our guide on how to set up manual email forwarding.
To do it automatically, refer to this guide - Automatic email forwarding.
In the Spam Analysis tab, you will find the results of the Spam and Blacklists Report.
The Spam report provides you with an overall score and an 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
Click the Show headers link in the main message menu or select the Tech Info tab and you’ll see all the headers.
Typically, it’s trickier to inspect Bcc compared to regular headers. But it’s not like that with Mailtrap as we analyze SMTP commands in the email and compare recipients and headers. Check our Email headers and Bcc Knowledge Base guide for more information on how to run this test.
Learn how exactly Mailtrap can help you streamline email testing processes from our case study with The Software House.
Automate testing with Email Testing API
You can automate your testing process with our Email Testing API.
Mailtrap Testing API uses the REST protocol and can return calls as a JSON object. To get more information and examples, go to Mailtrap API Documentation, as linked above.
Mailtrap Email Sending (SMTP/API)
For starters, Mailtrap Email Delivery Platform is an end-to-end sending solution for businesses and individuals to test, send, and control emails in one place.
As explained earlier, you can inspect and debug emails in staging with Email Testing. Then, send to your recipients on production with our reliable Email Sending.
Finally, use Mailtrap Actionable Analytics to control your emails. It allows you to catch and fix early-stage sending issues with a toolset consisting of - Regular Weekly Reports, Critical Alerts, up to 60 days of email logs, and all vital metrics.
How to integrate Mailtrap Email Sending (API/SMTP)
There are two ways to do it - using API or SMTP.
But before that, you need to add your domain to Mailtrap to start sending emails. Usually, it’s your company’s website; that is - the domain you want to send emails from.
To add a domain, log into Mailtrap, select Email API from the menu on the left, then Sending Domains from the drop-down menu.
Next, you need to verify your domain using the given DNS records. All of the DNS records need to be pasted to your domain provider’s DNS settings. After doing that, click the Verify all button.
If you want to get a better understanding of DNS records and their importance, check our Knowledge Base article.
Note that some records may take up to 72 hours to take effect and the length of time depends on many factors, including how your domain provider operates. Sometimes it takes just a few seconds, but unfortunately, this isn’t a parameter we can affect.
If Mailtrap doesn’t see your DNS records within a few hours, it’s better to contact your domain provider and/or our support.
To read the full domain setup tutorial, check the Sending Domain Setup article, or watch the video below.
After verifying DNS records, you can proceed by clicking the API and SMTP tab to integrate Mailtrap into your system.
Option 1. Email Sending API
In the API and SMTP tab, choose a code snippet from the list of integrations, copy the code sample, and run it.
Note that you can change the " from:", "to:", "subject:", "headers:" and "content:" values in the example code snippet.
Option 2. SMTP
Choose the SMTP tab and copy the given credentials and add them to your app script, MTA, and other settings.
Copy SMTP credentials:
- Host: send.smtp.mailtrap.io
- Port: 587 (recommended), 25, or 2525
- Username: api
- Password: API token
- Auth: PLAIN, LOGIN
- STARTTLS: Required
Important Note [Where to find API tokens]
To see all your API tokens click API in the menu on the left, then select API Tokens.
For more information on API tokens, go to this link.
What else you can do with Mailtrap Email Sending
After you’ve added a domain, verified it, and sent the first email to test the setup, there are a few other steps to help you get the most out of Mailtrap.
Set up Tracking
You can enable or disable tracking of opened emails and clicks on the Tracking Settings tab. By default, these two options are toggled on. Additionally, you can enable Use Custom Domain for Clicks Tracking. Enabling this feature requires adding one more DNS record to your domain provider.
Click here to read more about Tracking Settings.
Set up Unsubscribe
The Unsubscribe Settings tab gives you two options to set up an unsubscribe link to your emails. Unsubscribe Footer is toggled on by default, and it’s automatically added to the bottom of the emails you send. The Unsubscribe Link option is more flexible since you can place the link anywhere you want.
Click here to read more about Unsubscribe Settings.
Set up Webhooks
Select the Webhooks tab, click the Add New Webhook button, and set it up to get notified about specific email events almost real-time. Using webhooks, you get a JSON object with the email event data you select. We delivered to a designated endpoint and support Basic Auth (strongly recommended) and TSL 1.2.
Click here to read more about Webhooks.
Other than setting up tracking, unsubscribe links, and webhooks, it’s advisable to add email categories and necessary to add suppressions if you’re migrating to Mailtrap from a different solution. The sections below give you a quick overview of the benefits of these features and how to use them.
Add Email Categories
Email categories are keywords or tags that you assign to each of your emails.
They allow you to better segment your emails and track the performance of each email group. Also, categories give you the option to A/B test the same type of emails and clearly see which one performs better across all stats. Lastly, adding categories simplifies searching and debugging of a particular email type.
Select Email Categories and click the Set up Categories Now button to land on this article, which details how to code categories into your emails.
Select Suppressions from the menu on the left and click the Add New/Import button to add them. You can add suppressions manually, or automatically by uploading a CSV file. There’s also an option to choose a domain relating to a particular address or list to be suppressed.
Important: You need to add a suppression list when migrating from another sending service to Mailtrap. Unless you do that, you’ll email recipients who unsubscribed or bounced before, and it’ll worsen your deliverability.
For more information on how to manage suppressions, check our Knowledge Base article.
Control production emails with Actionable Analytics
As previously mentioned, Mailtrap Email Delivery Platform is an end-to-end solution for businesses and individuals to Test, Send, and Control their emails.
We already covered the testing and sending parts. The following sections give you a quick guide on how to use Mailtrap Actionable Analytics to track your email performance, troubleshoot faster, and improve your deliverability.
Note: You need to send 500+ emails a week to get the Actionable Analytics/Stats Overview.
Clicking on Stats in the menu on the left reveals the color-coded Stats Overview, which is one place to preview all your critical metrics. It’s designed to give you a clear snapshot of email deliverability and easy access to more specific data points.
The top five scorecards show vital stats for the selected period and a percentile comparison to the previous period.
The top five scorecards show vital stats for the selected period and a percentile comparison to the previous period.
Mailtrap sets the thresholds for the most vital stats based on cross-industry research and examples of best practices. Currently, the thresholds are:
- 2-5% is a warning level (yellow)
- >5% is a critical level (red)
- 0.08%-0.1% is a warning level (yellow)
- >0.1% is a critical level (red)
Unique Open Rate
- <95% of the unique open rate of your account is a warning level (yellow)
- <80% of the unique open rate of your account is a critical level (red)
You can also preview the vital stats visually, using the charts in the bottom section of the Stats Overview window. The chats feature a threshold line and a link to Email Logs to automatically filter to emails for the selected metrics.
Other than that, the Stats Overview dashboard shows you tables with stats across the most popular Mailbox Providers (like Gmail, Outlook, Yahoo, etc.) and the Categories you set.
Overviewing these stats is important because you can quickly see what goes wrong and where. For example, you might see that the open rates drop significantly with Outlook, meaning that you have deliverability issues with Outlook. Or see an increase in spam complaints for one of your email categories, which means you should review the content of that email and understand why the audience reacts to it like that.
To find out more about Mailbox provider stats and how to use them, check our What are mailbox providers article.
With Mailtrap, you can get two kinds of deliverability alerts.
- Health Status Weekly - Mailtrap sends Health Status Weekly on Mondays and you get a detailed preview of Opens, Clicks, Bounces, Unsubscribes, and Spam data. Plus, there’s a percentile comparison to the previous week and digest explanations of the stats to help you troubleshoot faster.
- Critical Alerts - Mailtrap inspects your metrics every three hours. And Critical Alerts are sent hourly when your stats go under the predetermined threshold.
Click here to find out more about Mailtrap Deliverability Alerts and see how you can get them on Slack.
Email Logs are among the core Mailtrap Email Sending features and the place to see all emails sent from your account, as well as, delivery history including delivery events and server response. You also get extensive filtration options - e.g. by email status, recipient email, or delivery events.
Clicking on an email within the Email Logs reveals the extensive data for that particular email.
If you want to learn more about those data points and Email Logs in general, click here.