When working in PHP you come accross situations where you need to see the current emails sent using PHP’s mail function. For this you need a a mail catcher.
The 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.
Follow those steps to get you ready:
- Install the ruby and rubygems as described here
- Install mail catcher
gem install mailcatcher
- Add an alias (check also how to permanently add aliases in bash)
alias mc='D:/tools/ruby/bin/mailcatcher.bat'
- Edit php.ini settings near [mail function]
SMTP = 127.0.0.1 smtp_port = 1025 sendmail_from = aidrissi@example.com
- Restart Wamp server
- Now run this command to open a browser and listen for the mails!
mc -b
This will open a browser window with mail catcher admin.
Errors?
I had an error with utf-8 characters and fixed it by the following:
First stop the ruing mailcatcher from the browser (the quit button) then downgrade mailcatcher to the version without error with character encoding:
gem uninstall mailcatcher
gem install mailcatcher -v 0.5.12
Give a try to service https://debugmail.io/.