This is how I test my php code sending mail (with mail()
function) using
- Ubuntu server
- MailCatcher gem
- php development server
Install MailCatcher
sudo apt-get install ruby ruby-dev
sudo gem install mailcatcher
Start PHP server
php -d sendmail_path="env /usr/local/bin/catchmail -f noreply@domain.com" -S 0.0.0.0:8080
Start MailCatcher
mailcatcher
Run and check
- Run the script by visiting the page (that sends mail)
- Check the mail at
Related tasks
- check which php.ini is in effect by running
php --ini
- check
sendmail_path
has been set correctly or not by usingecho phpinof()
in a page - check the path of catchmail by running
which catchmail
- close the mailcatcher server from web interface
- read mailcatcher help by running
mailcatcher --help
- read php help
php --help