How to use Mailcatcher on Cloud9?

rails

#1

Mailcatcher is a gem for Rails that redirects outbound email from a development Rails app to a local interface so you can check outbound emails / confirm email addresses and go thru normal app flow.

Running it on Cloud9 isn’t perfectly straightforward because it requires configuring some ports.

Mailcatcher instructions say to set your outbound smtp address and port to be localhost:1025, and to set the mailcatcher http interface to a specific port.

I’ve followed some incomplete community answers on the topic (links below), and have set the mailcatcher http interface to 8081 so I can view it at my c9users.io:8081.

mailcatcher --http-port 8081 --http-ip $IP
And I’ve specified my smtp outbound address to be localhost:1025

config.action_mailer.smtp_settings = { :address => “localhost”, :port => 1025 }

And yet still, I’m not seeing any of the outbound mail show up in the mailcatcher interface at c9users.io:8081. The interface loads, but it doesn’t appear the outbound mail is successfully being received on port 1025.

Does C9 support 1025 as a local port I could deliver SMTP mail to? Or must I only use ports 8081, 8082, etc? I tried with 8082 as well, and still no luck.

Many thanks for insight!

https://stackoverflow.com/questions/27865170/using-mailcatcher-in-cloud9-ide
https://stackoverflow.com/questions/31558647/using-mailcatcher-on-cloud9-port-overlaps


#2

As far as I know we have 3 ports open 8080, 8081 and 8082. I’ve tried many different configuration but no luck :frowning:

Finally thanks to Alicja Cyganiewicz, it’s working!
Here’s how to do it:
Open new terminal window and paste
mailcatcher --foreground --http-port 8081 --http-ip $IP --smtp-port 8082 --smtp-ip $IP

On other terminal start your app

rails s -p $PORT -b $IP
And the configuration for config/environments/development.rb is

config.action_mailer.raise_delivery_errors = true
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = { address: "localhost", port: 8082 }

It’s working for me! Hope will help others