Do you know the feeling of copy and pasting the signup-link from this
development.log? Theres a better way to do this.
For our development environment we use Mailcatcher.
MailCatcher runs a super simple SMTP server which catches any message sent to it to display in a web interface. Run mailcatcher, set your favourite app to deliver to smtp://127.0.0.1:1025 instead of your default SMTP server, then check out http://127.0.0.1:1080 to see the mail that’s arrived so far.
In this blogpost I show you how we set it up in our projects.
Mailcatcher is an awesome way to preview all the mails your Rails App sends in the development environment.
Add MailCatcher and Foreman to your
Create a file named
Procfile. This is used to start Rails and MailCatcher together with one simple command.
web: rails s mail: mailcatcher -f
The last step is to configure Rails to send emails to MailCatcher:
Add these 2 lines to your
Now you can run
foreman start every time you want to start Rails.
This will start Rails and MailCatcher (which listens on port
Every time Rails sends an email MailCatcher will receive it and display it on at http://localhost:1080/.
You can toggle between the HTML and the text portion of the email and even inspect the source.
Good news for you. You can also use MailCatcher without Rails.
gem install mailcatcher
MailCatcher is one of these tools that we end up using whenever we start to send emails in a new project. I hope you like it as well.