Official WordPress and Email

I’m having a hard time understanding how the official wordpress docker image is supposed to work. Almost all installations will depend on email, at least when the first user comes in.

So, my question basically is: what is the best way to make email working with the official wordpress image? I believe, too much tweaking is not the best idea. So, would an additional image containing the email service make sense?

i don’t understand… email is just an identifier… which is stored in a database.
the system will send out the email to get the users confirmation like always…

according to the wordpress doc you need to configure the email server to send thru

so you start up the image and login as admin like always and configure the smtp server the container sends user info thru

The keyword here is “the system”. The point is, WP does not send email itself. It only contains a wrapper that passes the email to the local smtp daemon that passes it along to the relay host.

As far as I know, there is no smtp daemon installed and / or configured. Therefore, whatever WP does, email will not be sent.

see Email does not work · Issue #30 · docker-library/wordpress · GitHub

Yes, I know that post. So you say its the best solution to install a smtp daemon into the wordpress container?

that is one approach… i think the mstp server could be remote from the container too, based on the wordpress config…

I don’t know the technology myself, never having used it, but most apps don’t depend on the mail server being ON the same system (I have never seen one that does)…

Sorry for the late reply.

I had a similar problem recently. So I’ve explored a few different solutions. IMHO the best approach is to run an SMTP server like Postfix in a separate Docker container. Then you should be able to connect to that container by the container name (provided both containers are in the same Docker user-defined network) and send e-mails.

The full reply would be too long to post here. So I have created a separate article here. It contains a description of possible solutions. The article shows 2 examples of using Postfix in a separate container (one with DKIM and one without) plus an example of adding Postfix to the original WordPress image (I would advise against adding Postfix to the WordPress image directly though since such things are not recommended by the Docker best practices: please see the section Decouple applications).

I have tested all the examples in the article on my site. So I made sure sending e-mails from WordPress in all the examples worked for me.

If you have any other ideas or solutions for this problem, I would be grateful if you could possibly let me know.

1 Like

Excellent info! This email issue isn’t apparent until you start deploying containers and realize that none of them can send email. I’ve been looking for a Docker-centric solution, and this seems to fit the bill. Thanks!