MODX + MailCatcher
Thanks to Thorsten Born of the MODX community for providing the mail settings.
A Real (Ruby) Gem
MailCatcher as you probably guessed is a Ruby Gem created by Samuel Cochran. It functions as a local SMTP server with a basic GUI for email testing, sending and debugging which is useful for Web application development.
I use it for CMS work to ensure my front-end forms are functioning properly before going live. For the purpose of this tutorial I’ll show you how to configure the MODX mail settings, but MailCatcher could be used with other Web applications/CMS1.
MODX Mail Configuration
- Sign-in to the MODX Manager.
- Go to Menu > [ Cog ] > System Settings.
- Leave the picker at the default core setting and in the Filter by area... picker select Mail. You should see 13 Mail settings. We’re only concerned with 4 of them.
- Leave
SMTP Authentication
set to the defaultNo
. - Set
SMTP Hosts
to127.0.0.1
. - Set
SMTP Port
to1025
. - Set
Use SMTP
toYes
.
Installing MailCatcher
For those new to using the Terminal or command-line, after typing or copying/pasting a command hit Return then wait for the next prompt before entering the next command.
- Using the Terminal (command-line) type
gem install mailcatcher
hit Return and wait for the prompt. - Then type
MailCatcher
and hit Return. If all goes well you should see:
Starting MailCatcher==> smtp://127.0.0.1:1025 ==> http://127.0.0.1:1080 *** MailCatcher runs as a daemon by default. Go to the web interface to quit.
- In your browser go to http://localhost:1080/, you should now see the MailCatcher GUI. Your locally sent messages will appear here.
Mail will now be sent through smtp://localhost:1025.
* To (re)start MailCatcher repeat Step 2.
You’re Ready to Go
You should now have MailCatcher running in your browser, and if you configured the mail settings correctly when you send emails through your local MODX-built site they should instantly appear in the MailCatcher GUI. The MailCatcher site has additional advanced configuration options which may be of interest to you technical types.
Alternatively MailHog (see my tutorial) is another option. It performs essentially the same function as MailCatcher albeit with some minor differences. It’s also written in Go, not Ruby, if that matters to you.
1 Depending on the application the configuration process may vary.