Summary
Implement solution for email sending, as discussed in#204 and also attempted earlier in#217 for v3.
This PR implements the followingfeatures
Explain themotivation for making this change. What existing problem does the pull request solve?
Most PHP hosters make the "mail()" function usable, so many PHP application expect it to be usable. With this image, those applications were unable to send email.
Test plan (required)
Seebuild-and-test.sh, the commands from there can also be run manually; the mails sent with the demo credentials can be viewed onhttps://ethereal.email/messages.
# Let's check that we can send mail directlyTESTMAIL_ID_DIRECT=$RANDOMdocker run --rm -e DMA_BLOCKING=1"thecodingmachine/php:${PHP_VERSION}-${BRANCH}-${BRANCH_VARIANT}" php -r"mail('lemuel.ratke46@ethereal.email', 'Hello World${TESTMAIL_ID_DIRECT}', 'This is an automatic test email, using a direct connection.');"# Let's check that we can send mail through a smarthost with credentials# Sending to an MCAST-TEST-NET IP address as that must not appear on the public internet according to RFC 5771, and will thus be unreachable for direct sending.TESTMAIL_ID_SMARTHOST=$RANDOMdocker run --rm -e DMA_BLOCKING=1 -e DMA_CONF_SMARTHOST=smtp.ethereal.email -e DMA_CONF_PORT=587 -e DMA_CONF_SECURETRANSFER= -e DMA_CONF_STARTTLS= -e DMA_AUTH_USERNAME=lemuel.ratke46@ethereal.email -e DMA_AUTH_PASSWORD=pjxG3kc3VR31jQUvHz"thecodingmachine/php:${PHP_VERSION}-${BRANCH}-${BRANCH_VARIANT}" php -r"mail('lemuel.ratke46@233.252.0.0', 'Hello World${TESTMAIL_ID_SMARTHOST}', 'This is an automatic test email, using a smarthost.');"# Let's check that the mails came throughETHEREAL_COOKIEJAR=$(mktemp --tmpdir ethereal-cookies.XXXXXXXXXX)ETHEREAL_CSRF=$(curl https://ethereal.email/login -s --fail -c"${ETHEREAL_COOKIEJAR}"| grep -Pom1'\bname="_csrf" value="\K[^"]+')curl https://ethereal.email/login -s --fail -X POST --data-urlencode"address=lemuel.ratke46@ethereal.email" --data-urlencode"password=pjxG3kc3VR31jQUvHz" --data-urlencode"_csrf=${ETHEREAL_CSRF}" -b"${ETHEREAL_COOKIEJAR}" -c"${ETHEREAL_COOKIEJAR}">/dev/nullETHEREAL_INBOX=$(curl https://ethereal.email/messages -s --fail -b"${ETHEREAL_COOKIEJAR}")rm"${ETHEREAL_COOKIEJAR}"echo"${ETHEREAL_INBOX}"| grep -F">Hello World${TESTMAIL_ID_DIRECT}<"echo"${ETHEREAL_INBOX}"| grep -F">Hello World${TESTMAIL_ID_SMARTHOST}<"Closing issues
Fixes#204
Checklist
Summary
Implement solution for email sending, as discussed in#204 and also attempted earlier in#217 for v3.
This PR implements the followingfeatures
build-and-test.shExplain themotivation for making this change. What existing problem does the pull request solve?
Most PHP hosters make the "mail()" function usable, so many PHP application expect it to be usable. With this image, those applications were unable to send email.
Test plan (required)
See
build-and-test.sh, the commands from there can also be run manually; the mails sent with the demo credentials can be viewed onhttps://ethereal.email/messages.Closing issues
Fixes#204
Checklist