whatwg / blog.whatwg.org

WordPress Theme for blog.whatwg.org
Creative Commons Zero v1.0 Universal
5 stars 4 forks source link

Password reset emails not being set #16

Open domenic opened 2 years ago

domenic commented 2 years ago

It seems the default PHP docker container cannot send mail.

Some helpful-looking pages:

domenic commented 2 years ago

I almost got something similar working on wiki.whatwg.org using this recipe: https://github.com/whatwg/wiki.whatwg.org/commit/28725a6290975630cfc78fb09e44766da27c1c8f

It worked when trying locally but failed when trying live due to what some Googling said was a permissions error. The next step would be trying to fix the permissions in various ways such as https://unix.stackexchange.com/a/605314/190444 .

However instead I went with a different approach of having Mediawiki use our SMTP server directly instead of using ssmtp, in https://github.com/whatwg/wiki.whatwg.org/commit/c6c3f93ab1f17510f6718d3dcd930ed909d94881.

So for the blog we have two paths:

To be continued, probably...

domenic commented 2 years ago

Step 3 of https://www.e-tinkers.com/2020/09/simple-steps-to-setup-wordpress-smtp-email-without-a-plugin/ is promising as an even easier path. It implies that we need to do steps 1 and 2 also but I am skeptical; maybe some version of step 3 alone would suffice.

domenic commented 1 year ago

I seem to have a local branch with the following changes: an entrypoint.sh with

#!/bin/bash
set -euo pipefail

cat >> /etc/ssmtp/ssmtp.conf <<-EOCFG
# Fastmail setup
mailhub=smtp.fastmail.com:465
AuthUser=${FASTMAIL_USERNAME}
AuthPass=${FASTMAIL_PASSWORD}
AUthMetod=PLAIN
UseTLS=YES
UseSTARTTLS=NO
FromLineOverride=YES
EOCFG

docker-php-entrypoint apache2-foreground

and the following diff:

diff --git a/Dockerfile b/Dockerfile
index ff70209..cb4bf26 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,2 +1,10 @@
 FROM wordpress:5.9.2-php8.1-apache
+
+# Enable sending mail (see also some config in entrypoint.sh)
+RUN apt-get update && apt-get install -y ssmtp && apt-get clean && \
+    echo 'sendmail_path = "/usr/sbin/ssmtp -t -i"' > /usr/local/etc/php/conf.d/mail.ini
+
 COPY org.whatwg.awesome /var/www/html/wp-content/themes/org.whatwg.awesome/
+
+ENTRYPOINT ["/bin/bash"]
+CMD ["/entrypoint.sh"]

I have no recollection of whether these were working or when I was working on this, but it's probably better to dump them here than to just blow away my local branch forever.