$ php -r "mail('[email protected]', 'test', 'test');"
2015/12/09 16:44:17 Using in-memory storage
2015/12/09 16:44:17 [SMTP] Binding to address: 0.0.0.0:1025
2015/12/09 16:44:17 [SMTP] Error listening on socket: listen tcp 0.0.0.0:1025: bind: address already in use
Fixed this by installing ssmtp and updating /etc/php5/cli/conf.d/zzzz_custom.ini to:
;sendmail_path='/usr/local/bin/mailhog'
sendmail_path='/usr/sbin/ssmtp -t'
/etc/ssmtp/ssmtp.conf:
...
mailhub=localhost:1025
...
Possibly there are better ways but this one worked for me.
My config.yml:
http://pastebin.com/jGqghAqF
;sendmail_path='/usr/local/bin/mailhog'
You actually want this to be
sendmail_path='/usr/local/bin/mailhog sendmail [email protected]'
See: https://github.com/puphpet/puphpet/blob/master/archive/puphpet/puppet/manifests/Php.pp#L204
FYI for others looking for why MailHog may not be catching Php SMTP emails.
check your ports! if you are using a Mail::factory or other class for SMTP emails, then it may default to port 25. MailHog configuration defaults to port 1025.
@Artistan thanks.
basically:
I am used to CakePHP3 (where things are a bit easier to decipher) and this way I could test Zend Framework sendmail contact forms.
Most helpful comment
You actually want this to be
See: https://github.com/puphpet/puphpet/blob/master/archive/puphpet/puppet/manifests/Php.pp#L204