So i've seen a couple of questions about setting up notifications for PHP-based websites, so i'd like to ask you for the best approach. For that,
I have:
- a WordPress website with custom PHP packages hosted locally, no containers,
- working sendmail setup being used by PHP working as a smart host, we use a Mailgun account and send mails generated by WordPress to their SMTP,
I want:
- the same WordPress website I host locally but in Docker,
- emails are being sent in the same way as it was locally set,
- I want to avoid hosting anything outside Docker (except nginx).
Options I've seen are:
- hosting postfix locally (as it can listen on public port and docker0) and using SMTP client on the website container sending mails to a local postfix instance, then postfix instance sending emails to Mailgun SMTP,
- the same option as above but with hosting postfix on Docker,
- using just a small client on the website container and that's all what's needed (although no idea if that would work since I have no good experience in setting up mail servers).
Extra questions which would let me understand the problem better:
- since I want to avoid hosting anything locally, the best approach would be if I hosted Postfix on Docker container, then some small SMTP client like
msmtp
on the website container so I can replacesendmail
being used as a default way to send mails. Do I have to expose port 25 outside the Docker network or having the port exposed within the network is enough? - can I just use a small SMTP client like
msmtp
on the website container and that would be enough? if not, why?