OSX: Getting Mails Sent Out By Your Script On Your Local System With 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.

 

Setting Up

Normally, the command below should work:

$ gem install mailcatcher

But if you are having challenges, try this:

$ gem install mailcatcher -- --with-cflags="-Wno-error=implicit-function-declaration"

At the time of this tutorial, I was testing this one:

OSX Catalina.

$ rvm --version

rvm 1.29.12-next (master) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io]

$ ruby --version

ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-darwin19]

 

To start mailcatcher:

$ mailcatcher

Starting MailCatcher

== smtp://127.0.0.1:1025

/usr/local/rvm/gems/ruby-2.4.0/gems/thin-1.5.1/lib/thin/server.rb:104: warning: constant ::Fixnum is deprecated

== http://127.0.0.1:1080/

*** MailCatcher runs as a daemon by default. Go to the web interface to quit.

 

Starting Mail-Catcher On Login

https://gist.github.com/sj26/1638617

Place me.mailcatcher.plist into ~/Library/LaunchAgents, then run launchctl load ~/Library/LaunchAgents/me.mailcatcher.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>me.mailcatcher</string>
<key>ProgramArguments</key>
<array>
<string>sh</string>
<string>-i</string>
<string>-c</string>
<string>$SHELL --login -c "mailcatcher --foreground"</string>
</array>
<key>KeepAlive</key>
<true/>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>

No comments

Add Comment

Enclosing asterisks marks text as bold (*word*), underscore are made via _word_.
Standard emoticons like :-) and ;-) are converted to images.

To prevent automated Bots from commentspamming, please enter the string you see in the image below in the appropriate input box. Your comment will only be submitted if the strings match. Please ensure that your browser supports and accepts cookies, or your comment cannot be verified correctly.
CAPTCHA