Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP Configuration hints #99

Closed
rfay opened this issue Jun 23, 2016 · 8 comments
Closed

PHP Configuration hints #99

rfay opened this issue Jun 23, 2016 · 8 comments

Comments

@rfay
Copy link

rfay commented Jun 23, 2016

I had loads of trouble trying to get MailHog (with or without mhsendmail) to work with php-fpm (MacOS, homebrew, php5.6, mailhog 0.2)

I finally got it going with this in php.ini:

sendmail_path = "/usr/local/bin/mailhog sendmail [email protected]"

I can do a PR to add that simple recipe to the docs if you'll direct me where to put it.

(I do see that hint in mailhog/mhsendmail#3 (comment), which is where I got it, but that was closed.)

@ian-kent
Copy link
Member

ian-kent commented Jul 7, 2016

mailhog/mhsendmail#3 should have fixed it, assuming you have a To: header in the message

It could be worth adding some documentation to mention it - PHP config is mentioned in the mhsendmail readme, but currently without the e-mail address in the path

@rfay
Copy link
Author

rfay commented Jul 7, 2016

Hmm, maybe a new release for mhsendmail is the key fix?

Note that I couldn't get mailhog 0.2.0 to work without the gratuitous [email protected], but it works fine with it.

@ian-kent
Copy link
Member

ian-kent commented Jul 7, 2016

It might be that (really need to fix #71!), but if you've tried the MailHog sendmail one then it should use the latest mhsendmail for whichever version of MailHog you have installed

I'll do a new release after I've got through some open issues, hopefully that'll fix it!

@rfay
Copy link
Author

rfay commented Jul 7, 2016

OK, thanks for your work on this. MailHog is awesome. A real step forward in my dev workflow. Love the "delete all".

@ian-kent
Copy link
Member

ian-kent commented Jul 7, 2016

Thanks @rfay, and no problem, glad its useful 😄

@SlayerBirden
Copy link

A tip to anyone wondering how to use Mailhog if it's running on a separate instance (not the php server) - for example on a separate docker container.

All you need to do is modify the sendmail_path on php server to include -S option:

sendmail_path = /usr/sbin/sendmail -S mail:1025 -t

Where "mail" is the alias of my container running Mailhog.

@ian-kent
Copy link
Member

👍 thanks for the info, I've added the info to the MailHog README including a php.ini example

@Feyisayo
Copy link

Feyisayo commented Jun 3, 2017

I would like to add that using sendmail in debian docker containers seem to have issues. A good replacement is ssmtp.

Install using apt install ssmtp

ssmtp can be configured to use mailhog by editing /etc/ssmtp/ssmtp.conf like so:

[email protected]
# replace mailhog with the name of the mailhog service
mailhub=mailhog:1025
hostname=yourserver.example.com
FromLineOverride=YES

PHP can then be configured in php.ini like so:
sendmail_path = /usr/sbin/ssmtp -t

Some more details on ssmtp can be found here

This worked for me. I hope someone finds it useful

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants