QREATiv | Tutorial: Using MODX with MailCatcher Local IMAP Email Server


Search

The Goal

Learn how to install the MailCatcher SMTP server and configure the MODX mail settings for local email testing.

Author
Name:
Profession: Web Designer
Specialties: hand-drawing
Years’ Experience: 20
Employer: Self-employed
Tutorial Details
Difficulty Level: ★★
  • Basic / Inexperienced
  • ★★ Easy / Beginner
  • ★★★ Moderate / Experienced
  • ★★★★ Difficult / Expert
  • ★★★★★ Complex / Über Geek
Tools: MailCatcher, MODX, Terminal
Completion Time: Less than 15 minutes
Related Article: Source
Tags: mailcatcher, modx, ruby

This is a member-contributed tutorial. If possible, contact the author with questions or comments.

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

  1. Sign-in to the MODX Manager.
  2. Go to Menu > [ Cog ] > System Settings.
  3. 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.
  4. Leave SMTP Authentication set to the default No.
  5. Set SMTP Hosts to 127.0.0.1.
  6. Set SMTP Port to 1025.
  7. Set Use SMTP to Yes.

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.

  1. Using the Terminal (command-line) type gem install mailcatcher hit Return and wait for the prompt.
  2. 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.
  3. 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.

Depending on the application the configuration process may vary.


Tutorials Archive show by year/month