Installing and Running MailCatcher in PHP localhost

Catches mail and serves it through a dream.

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.



MailCatcher Ubuntu Installation

1. Install mailcatcher dependency
sudo apt install build-essential libsqlite3-dev ruby-dev

2. Install mailcatcher
sudo gem install mailcatcher

3. Run Mailcatcher
mailcatcher --ip 127.0.0.1

4. Set Send mail Path in php.ini file
sendmail_path = /usr/bin/env catchmail --smtp-ip 127.0.0.1 --smtp-port 1025

4. Go to http://127.0.0.1:1080/

5. Send mail through smtp://127.0.0.1:1025


Simple PHP mail() function
You can easily test mail using php() function. You can receive email's in "http://127.0.0.1:1080/" URL and test your email body & header details in local.

PHP Mailer SMTP details

smtp port = 1025
mail protocol = smtp
smtp server = 127.0.0.1
smtp username = ''
smtp_password ''   

Comments