Email Testing with Mailtrap

When building and setting up your site locally, you might wish to test and debug email notifications from Freeform without bothering your client and/or setting up an email server on your development environment. In cases like this, we highly recommend trying out an email testing service such as Mailtrap.

Mailtrap simulates a real SMTP server and allows you to see that each email notification was sent, as well as view all of the recipients' email messages in a single unified inbox, complete with tools to analyze and troubleshoot. This speeds up the testing process and lets you verify how each notification is rendered, etc. For more information, click here to see how it works.

Follow the instructions below to set up Mailtrap for Craft (which then hijacks/controls all email notifications from Craft and Freeform, etc):

  1. Sign up for a Mailtrap account.
  2. Select the Free account to start (or a paid account if you think you need it).
    • Please note that the Free account does have some limitations:
      • Maximum 500 emails per month
      • Maxmium 2 emails every 10 seconds

        WARNING

        This is important to note, as some Freeform forms may be generating more than 1 email notification. If so, Mailtrap will only collect/display 2 of the X number of notifications from Freeform.

  3. Once your account has been created, click into your new inbox (probably named Demo inbox). The inbox page will default to having an SMTP Settings tab open with credentials. Mailtrap SMTP Credentials
  4. Open a new browser tab and go to the Email settings area in your Craft control panel (CP -> Settings -> Email), and then set up Mailtrap for Craft:
    • Transport Type - select SMTP
    • Host Name - use smtp.mailtrap.io
    • Port - use 2525
    • Check off the Use authentication checkbox
    • Username - copy and paste the username in Mailtrap, e.g. 657gfg765df7f5
    • Password - copy and paste the username in Mailtrap, e.g. 87a569f8768765
    • Encryption Method - select TLS
    • Timeout - 10 Craft Email Settings
  5. Click the Test button to verify it's working correctly. If it worked, you'll see an email message inside your Mailtrap inbox. Mailtrap Success

That's it! Now any email notification generated by Craft, Freeform or other third party plugins will use Mailtrap.

Last Updated: 11/4/2019, 5:27:23 PM