-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Can't use mailhog through php mail function #999
Comments
Just encountered the same issue. My host machine is Windows 10. A workmate running the same code on a Mac as I do does not have this issue. |
Issue I had running the mentioned test above inside the workspace using tinker was Did set
In In the logs I saw:
Found out at https://github.com/ilyasotkov/docker-php-msmtp that
The Docker README however states you can use Mailhog Sendmail:
Neither are to be located inside the php-fpm container. In the Mailhog container it is though under Changing the sendmail path in
so the sendmail needs to be inside php-fpm it seems. Update: Then I read at mailhog/MailHog#99 that mail in the earlier mentioned sendmail line is the alias for the container so I tried |
hello, @g4b0 @devployment @jasperf . I have the same |
try PHPMailer use SMTP. |
I needed to have this for a legacy project which I can not change to use a proper mailer. The following linked thread and comment resolved the issue for me, and I'm now able to use MailDev with the standard php mail() function. With some adaptation it could support whatever reasonable solution is desired. I did not dig too deeply into the specific configuration, and only followed the author's instruction. It worked. I'm currently unaware of any side effects.
###########################################################################
# SENDMAIL:
###########################################################################
ARG INSTALL_SENDMAIL=false
RUN if [ ${INSTALL_SENDMAIL} = true ]; then \
apt-get update && apt-get -q -y install ssmtp mailutils \
&& rm -rf /var/lib/apt/lists/* \
&& echo "hostname=localhost.localdomain" > /etc/ssmtp/ssmtp.conf \
&& echo "root=<your-email>" >> /etc/ssmtp/ssmtp.conf \
&& echo "mailhub=maildev" >> /etc/ssmtp/ssmtp.conf \
&& echo "sendmail_path=sendmail -i -t" >> /usr/local/etc/php/conf.d/php-sendmail.ini \
&& echo "localhost localhost.localdomain" >> /etc/hosts \
;fi Note for anyone attempting this on their own - You have to follow the existing pattern for Would be better to abstract the variables. Apologies for the lack of PR. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This should probably not be closed. |
Well, perhaps you should make this a PR after all @dboune . And one with variables added for |
@jasperf I don’t disagree. However I’m no longer using laradock at the moment (though I’d like to be), and unfortunately this reminder comes right as I’m neck deep. If I can come back to it, I will do so. |
Hi 👋 this issue has been automatically marked as |
Hi again 👋 we would like to inform you that this issue has been automatically |
Info:
$ docker --version
): 17.03.1-ce, build c6d412e$ git rev-parse HEAD
): 5899596Issue:
What seems to be going wrong?
I'm working on a project that use php mail() to send email and I'm not able to send mail through mailhog.
Expected behavior:
What should be happening instead?
No email is sent, and the following appear in php-fpm logs:
php-fpm_1 | [05-Jun-2017 07:03:11] WARNING: [pool www] child 7 said into stderr: "sh: 1: -t: not found"
php-fpm_1 | 172.21.0.6 - 05/Jun/2017:07:03:11 +0000 "GET /email.php" 200
Reproduce:
How might we be able to reproduce the error?
Just run the following script
Relevant Code:
The text was updated successfully, but these errors were encountered: