Skip to content

Instantly share code, notes, and snippets.

@fradee
Forked from shark0der/setup_mailcatcher.sh
Last active March 9, 2017 08:07
Show Gist options
  • Save fradee/05b093107cb5a4950597710713c56dfc to your computer and use it in GitHub Desktop.
Save fradee/05b093107cb5a4950597710713c56dfc to your computer and use it in GitHub Desktop.
Mailcatcher installation script for Ubuntu 16.04 (14.04 commands commented out)
#!/bin/bash
# Install dependencies
# older ubuntus
#apt-get install build-essential libsqlite3-dev ruby1.9.1-dev
# xenial
apt install build-essential libsqlite3-dev ruby-dev
# Install the gem
# gem install mime-types -v 2.6.2 (gem install mime-types --version "< 3" gem install --conservative mailcatcher)
gem install mailcatcher
# Make it start on boot
echo "@reboot root $(which mailcatcher) --ip=0.0.0.0" >> /etc/crontab
update-rc.d cron defaults
# Make php use it to send mail
# older ubuntus
#echo "sendmail_path = /usr/bin/env $(which catchmail) -f 'www-data@localhost'" >> /etc/php5/mods-available/mailcatcher.ini
# xenial
echo "sendmail_path = /usr/bin/env $(which catchmail) -f 'www-data@localhost'" >> /etc/php/7.0/mods-available/mailcatcher.ini
# Notify php mod manager (5.5+)
# older ubuntus
#php5enmod mailcatcher
# xenial
phpenmod mailcatcher
# Start it now
/usr/bin/env $(which mailcatcher) --ip=0.0.0.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment