2

I'm trying to confirm mailcatcher as described in the following: [Using mailcatcher in cloud9 ide

which asks me to do

mailcatcher --http-port $PORT --ip $IP and you can access it from 

which would allow me to access mailcatcher on https://project_name-username.c9.io/

However, in order to run the mailcatcher command I have to quit the server on which I sent the email confirmation. Otherwise, I would get a following error about port being already in use.

mailcatcher --http-port $PORT --ip $IP
Starting MailCatcher
==> smtp://0.0.0.0:1025
~~> ERROR: Something's using port 8080. Are you already running MailCatcher?

If I quit the server and run the mailcatcher instead, it can access the mailcatcher page but the form would be blank.. no emails to confirm.

It looks like there isn't a way to choose a different port for my app to run on Cloud9, although in my last question I was hinted that port 8081 and 8082 is available (I still haven't figured out a way to work that out). Also, haven't figured out a way to run the mailcatcher on either 8081 or 8082.

If anyone knows how to get around this, please let me know!

sj26
  • 6,725
  • 2
  • 27
  • 24
SeoKim
  • 53
  • 1
  • 3

2 Answers2

5

MailCatcher runs two different services: SMTP to catch email from your application, and an HTTP web interface for viewing the caught email.

By default it binds both to the localhost IP address, 127.0.0.1, so that you can only use it on the same machine as is running MailCatcher. The IP address and port for each can be configured independently. The --ip is a shortcut to change the address for both services at once. This might mean you can no longer deliver email to the localhost SMTP address. So the previous answer is almost right, but should only change the HTTP address:

  • Configure your application to deliver email to 127.0.0.1:1025 using SMTP per normal MailCatcher instructions.
  • Start your application server on port 8080 using $PORT
  • Start MailCatcher exposing the HTTP service using $IP and another port:

    mailcatcher --http-ip $IP --http-port 8081

  • Open MailCatcher using your workspace URL but with the specified port:

    http://<workspace-name>-<username>.c9.io:8081

sj26
  • 6,725
  • 2
  • 27
  • 24
  • I've tried this, which I believe is the correct answer over Mutahhir's, however I still am not finding the emails in the mailcatcher inbox when I have them sent. Not sure what's going on. Maybe I have some code stopped mail altogether in development, I'll have to dive deeper. :( Has anyone gotten mailcatcher to work on cloud9 who can confirm this solution? – Sean Ahrens Aug 29 '17 at 00:08
  • This solution pretty much worked for me. However, the websocket feature of MailCatcher does not seem to work with Cloud9. Consequently, I have to manually refresh my MailCatcher browser tab to see new emails. Still, this post was very helpful. Thank you. – Tom Aranda Oct 03 '17 at 20:03
3

We're just rolling out support for multiple ports, so 8080, 8081, and 8082 should be available to you now. Here's how you can access them:

  • Start your application server on port 8080 using $PORT
  • Start mailcatcher with:

    mailcatcher --http-port 8081 --ip $IP

  • In your outgoing emails, you should set the url to use https://<workspace-name>-<username>.c9.io:8081 for the mailcatcher service (note the :8081)

Hope this helps.

sj26
  • 6,725
  • 2
  • 27
  • 24
Mutahhir
  • 3,812
  • 3
  • 21
  • 26
  • running ' mailcatcher --http-port 8081 --ip $IP ' and accessing [ https://-.c9.io:8081/ ] gives me _"No application seems to be running here!"_ – SeoKim Jul 22 '15 at 14:26
  • running ' mailcatcher --http-port 8082 --ip $IP ' and accessing [ https://-.c9.io:8082/ ] gives me _"SSL connection error"_ – SeoKim Jul 22 '15 at 14:30
  • when I just run as default 8080 (mailcatcher --http-port $PORT --ip $IP) mailcatcher page will load fine.. perhaps the ports you've mentioned haven't been made available yet? If it makes any difference, I'm currently using internet in Korea.. Thanks for the help! – SeoKim Jul 22 '15 at 14:33
  • This changes both the HTTP and SMTP service to bind to $IP. Also, HTTP and SMTP bind to different ports, so delivering to 8081 won't work. And MailCatcher runs http, not https. I've added another answer with some corrections. – sj26 Jul 27 '17 at 04:45