Skip to content

Instantly share code, notes, and snippets.

@PhilETaylor
Forked from pitpit/mailcatcher-install.md
Last active December 18, 2017 16:04
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PhilETaylor/b4d0bb87d6de0789e8e39bf6258a5965 to your computer and use it in GitHub Desktop.
Save PhilETaylor/b4d0bb87d6de0789e8e39bf6258a5965 to your computer and use it in GitHub Desktop.
Install Mailcatcher on OSX

Install MailCatcher (https://rubygems.org/gems/mailcatcher/versions/0.5.12)

brew install ruby
sudo gem install mailcatcher

Then set it a daemon:

 curl https://gist.githubusercontent.com/sj26/1638617/raw/67505ad7c9191298abcd64ccdcd0cdcf767dccac/me.mailcatcher.plist >>~/Library/LaunchAgents/me.mailcatcher.plist

then run

 launchctl load ~/Library/LaunchAgents/me.mailcatcher.plist
 launchctl start ~/Library/LaunchAgents/me.mailcatcher.plist     

To setup PHP: edit php.ini (on OSX brew, /usr/local/etc/php/5.5/conf.d/mailcatcher.ini and paste the following configuration:

echo "sendmail_path = /usr/bin/env catchmail -f catcher@mailcatcher.me" >> /usr/local/etc/php/7.1/conf.d/mailcatcher.ini && brew services restart php71

put any email you want instead of catcher@mailcatcher.me

If you got a `require': cannot load such file -- i18n/core_ext/string/interpolate (LoadError) exception:

sudo gem uninstall i18n
sudo gem install i18n -v 0.6.11
sudo gem install interpolate

(see sj26/mailcatcher#155)

Visit the mailcatcher backend : http://localhost:1080

To test it:

php -r "mail('john.doed@test.fr', 'test', 'test');"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment