Mailgun to Mailtrap:
A Migration Guide
This guide covers core principles of how to migrate from Mailgun to Mailtrap seamlessly: terminology comparisons, SMTP, or API Configurations, and other tech specifications needed for the smooth switch.
Mailtrap and Mailgun Differences
- Your emails are stored under Mailtrap Email Logs for up to 60 days, depending on your pricing plan. We also store email content and hard data between 3 and 15 days.
- Mailtrap offers monthly recurring plans with an option to request annual billing/plan. Unlike Mailgun, Mailtrap doesn’t feature a pay-as-you-go plan, but we have a 1000-emails Free Forever plan to test out and evaluate our service.
- Mailtrap has a separate product – Mailtrap Email Testing – to test your emails in staging, check spam score, validate HTML and CSS, and inspect deliverability with different mailbox providers. Critically, Mailtrap Email Testing is only for testing emails in a safe environment without sending them to your recipients.
- You can’t schedule emails to be delivered later with Mailtrap.
Mailtrap and Mailgun – Similarities
- Support for sending with SMTP or REST API.
- You can use return-path records and DKIM to verify a domain.
- When sending from a newly added domain, the throughput gets queued or throttled.
- You can add a .csv file to import suppressed email addresses.
- Both Mailgun and Mailtrap allow you to add unsubscribe options to emails without coding.
General step-by-step flow for migration
After signing up for Mailtrap, navigate to Sending Domains. Add your domain and proceed to verify it.
If you choose SMTP service, switch the sending settings as per the credentials Mailtrap provides. See info under the SMTP header below.
Take the time to understand the main differences between Mailgun and Mailtrap as shown above.
Need some help?
Contact our support and our tech experts will help you with it.
If you need to send more than 200K emails a month, don’t hesitate to get in touch with Mailtrap support. We’ll schedule a call with you to make sure you transition properly.
Use ActionMailer Balancer Ruby gem to proportionally distribute the email sending load between two different sending services (e.g. 60% Mailgun and 40% Mailtrap) to mitigate the sending risks.
It doesn’t take much to get started with Mailtrap. You only need to create an account then proceed to set up and verify your domain either from the in-app Homepage, or by selecting Sending Domains under Email API. Check our Getting Started Guide for more information and here is a quick walk-through on how it goes.
- After you sign up, then add and verify your domain, it undergoes a security check, which usually takes two business days. During that time, your throughput is limited to 100 emails per hour to prevent system abuse. Read our article on Sending Limits to learn more.
- It’s critical not to delete and re-add during the security check as it’ll be regarded as suspicious behaviour.
- You can get the limitation lifted with a support ticket where you’ll be asked to answer a few questions to prove your domain’s trustworthiness.
- Make sure you set unsubscribe options with Mailtrap and import your suppression lists from Mailgun.
|Mailgun Server (EU)||Mailgun Server (US)|
|587||The recommended SMTP relay with TSL.|
|25||High traffic, blocked by some mailbox providers due to abuse.|
|2525||Alternative port, in case you encounter issues with other ports.|
|465||For SSL SMTP connection|
After successfully verifying your domain, select SMTP under Integrations.
Copy-paste the credentials in to your app or project, and proceed to send a confirmation email to verify the setup. Check our Sending Domain Setup article for more information on how to do it.
Note: Turning TLS on is mandatory as mentioned in the credentials.
Mailtrap API tokens
Mailtrap automatically creates a token when you create a domain, and the token has a Domain Admin access permission by default. You can Edit permissions for that token to authorize it with other domains on your account.
For more information on how to manage API tokens, check our guide.
|Email Testing||Email Testing API|
At the moment there are four libraries available at Mailtrap.
|Ruby||Ruby SDK||Mailgun Ruby Gem|
|Python||Python SDK||Not supported|
Mailtrap uses Bearer authentication. So, you need to pass the API token under Authorization header of your email.
Starting from the Business plan on Mailtrap Email API, you can add users to your account and manage their permissions. Clicking on User Management reveals all users in a particular account where you can easily add new members and assign their permissions.
Based on the permissions users get, they’ll be able to view, access, and/or modify specific functionalities of an app. Note that a user needs Admin permissions to get authenticated and send emails via API.
Read more about managing users permissions
ActionMailer Balancer for smooth migration
For Ruby on Rails applications, Mailtrap offers ActionMailer Balancer that makes the migration smooth. ActionMailer extension allows proportionally distributing the email sending load between two different sending services and mitigating the sending risks.
After you install the Balancer to your application and do some minor configurations, it will extend the sending method of ActionMailer.
For more detailed info on the boilerplate and use in development, read the Mailtrap ActionMailer Balancer Github page.