Today I would like to write about a service that we use daily during development and pre-production, Mailtrap.

Mailtrap is a fake SMTP server for development teams to test, view and share emails sent from the development and staging environments without spamming real customers.

To set it up is very easy and for 1 inbox is also free. Simply hit the registration page, and head to the default inbox.

There you will see the inbox settings that can be used in your project. That’s it!

To make your job even easier, Mailtrap has a very useful Integration drop down that will show you how easy is to integrate to your framework of choice.

Here an example for Symfony 2/php:

Symfony 2.0 uses SwiftmailerBundle to send emails. You can find more information on how to send email on Symfony's website. To get started you need to modify app/config/config.yml and add the following:

swiftmailer:
  spool:     { type: memory }
  transport: smtp
  host:      mailtrap.io
  username:  xxxxxx
  password:  xxxxxx
  auth_mode: cram-md5
  port: 2525

 

And another example for Workpress:

You can configure WordPress SMTP by using this code:

function mailtrap($phpmailer) {
  $phpmailer->isSMTP();
  $phpmailer->Host = 'mailtrap.io';
  $phpmailer->SMTPAuth = true;
  $phpmailer->Port = 2525;
  $phpmailer->Username = 'xxxxx';
  $phpmailer->Password = 'xxxxx';
}

add_action('phpmailer_init', 'mailtrap');

Now every email sent out from your application will be “trapped” by Mailtrap for your convenience, without the need of creating tons of test emails.

Other cool features are API , Mail validity checks and sharing your inbox with the rest of your team.

Thanks Railsware for the excellent product.

Mailtrap with Symfony, testing emails has never been so easy 2016-12-23T12:44:23+00:00 Soipo

Comments are closed.

Privacy Preference Center

gdpr

We track users consent by creating a cookie and storing their preferences there.

soiposervices.com

_ga

Used to distinguish users.

soiposervices.com

_gat

Used to throttle request rate. If Google Analytics is deployed via Google Tag Manager, this cookie will be named _dc_gtm_.

soiposervices.com

_gid

Used to distinguish users.

soiposervices.com

lang

Used to understand the locale used by the user and present the right content.

cdn.syndication.twimg.com
Used to understand the locale used by the user and present the right content.

tk_lr

Collection of internal metrics for user activity, used to improve user experience.

soiposervices.com

tk_or

Collection of internal metrics for user activity, used to improve user experience.

soiposervices.com

tk_r3d

Collection of internal metrics for user activity, used to improve user experience.

soiposervices.com

NID

Used to distinguish users.

google.com
Used to distinguish users.

Close your account?

Your account will be closed and all data will be permanently deleted and cannot be recovered. Are you sure?

%d bloggers like this: