I just want to send simple email for testing purposes, but when executing sendmail inside the container, I get sendmail: can't connect to remote host (127.0.0.1): Connection refused
. What do I need to take into account when using sendmail inside Alpine container?
If you use the BusyBox sendmail, you can set the configuration in the php.ini file.
BusyBox sendmail relays to an SMTP server. You can specify the server on the command line, with the -S option.
My configuration in php.ini is:
sendmail_path = /usr/sbin/sendmail -S 172.16.239.1 -t -i
I'm using an SMTP server in another container.
https://technote.fyi/code/sysadmin/docker/configuring-alpine-linux-on-docker-to-send-mail-for-wordpress/
Set the SMTPHOST environment variable to the hostname or IP of your smtp server. The code to use this variable exist since since 2008-09-27 in the busybox sendmail commit (https://git.busybox.net/busybox/commit/?id=bed22a01fb19de6e4b4c2c7d8c5953bc7aa2580e) but the usage page was only updated on 2016-07-14 with the commit https://git.busybox.net/busybox/commit/?id=9de7509aa013a8634b13a29008cd58ca971c9c7c. Please note that the online documentation page doesn't reflect these changeshttps://www.busybox.net/downloads/BusyBox.html. Use sendmail --help to see the corrected usage.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With