Skip to content

Commit

Permalink
remove outdated sSMTP; update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
yuriipavlov committed Jun 23, 2024
1 parent 61d6706 commit 63fb815
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 94 deletions.
37 changes: 32 additions & 5 deletions README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -192,14 +192,41 @@ make docker push

## Sending emails

Docker containers do not have a custom SMTP server. We use an SMTP relay service. You can set up an SMTP server
like Gmail, AWS, Sendinblue, Mailgun, etc, or use another server you like.
Mail is not routed by the Docker containers, you must use an SMTP external service to route your site's email.

Just edit sSMTP config block in your `.env.secret` file.
The reason that mail is not routed is that configuring mail to route from the proper domain on a server is often a headache. A further headache is actually getting mail delivered from an arbitrary IP. A third issue is that mail servers consume resources. A fourth issue is security. So for all these reasons we decided not to implement mail and instead delegate that task to various providers.

sSMTP config files `./docker/wordpress/config/ssmtp.conf.template` and `./docker/wordpress/config/revaliases.template` automatically loaded into the WordPress container
You can set up an SMTP service like Gmail, AWS SES, Sendinblue, Mailgun, etc., or use another server you like.

Just edit SMTP config block in your `.env.main` and `.env.secret` files.

`.env.main`:
```bash
# SMTP config
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587

# none|ssl|tls
SMTP_SECURE=tls
SMTP_DEBUG=0
```

`.env.secret`:
```bash
SMTP_USER=your_smtp_service_user_name
SMTP_PASS=your_smtp_service_user_password
```

Also, to debug Emails on local you can use [MailHog](https://github.com/mailhog/MailHog) service. Just run:

```bash
make mailhog
```

`.env.type.local` file already has mailhog connection settings.

This will run MailHog container, and you can access it on `your-app-domain.com:8025` URL.

See [an example](https://www.wordpressdocker.com/mailgun-ssmtp/) of ssmtp.conf

## Database management
### SSH tunnel options
Expand Down
2 changes: 1 addition & 1 deletion config/php/php.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1106,7 +1106,7 @@ pdo_mysql.default_socket=

; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
; https://php.net/sendmail-path
sendmail_path = /usr/sbin/ssmtp -t -i
;sendmail_path =

; Force the addition of the specified parameters to be passed as extra parameters
; to the sendmail binary. These parameters will always replace the value of
Expand Down
8 changes: 0 additions & 8 deletions config/ssmtp/revaliases.template

This file was deleted.

35 changes: 0 additions & 35 deletions config/ssmtp/ssmtp.conf.template

This file was deleted.

2 changes: 0 additions & 2 deletions docker-compose.build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ services:
- ./logs/wordpress:/var/log/wordpress
# PHP ini config
- ./config/php:/usr/local/etc/php
# SSMTP config
- ./config/ssmtp:/etc/ssmtp/templates:ro
# Share shell scripts
- ./sh:/shell:ro

Expand Down
2 changes: 0 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ services:
- ./logs/wordpress:/var/log/wordpress
# PHP ini config
- ./config/php:/usr/local/etc/php
# SSMTP config
- ./config/ssmtp:/etc/ssmtp/templates:ro
# Share shell scripts
- ./sh:/shell:ro

Expand Down
2 changes: 0 additions & 2 deletions dockerfiles/php/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ RUN set -eux; \
ghostscript \
# Alpine package for "imagemagick" contains ~120 .so files, see: https://github.com/docker-library/wordpress/pull/497
imagemagick \
# Use SMTP relay service
ssmtp \
# Envsubst for operate with env variables in config files
gettext \
# Install wp-cli dependencies
Expand Down
39 changes: 0 additions & 39 deletions dockerfiles/php/docker-entrypoint.d/20-prepare-configs.sh

This file was deleted.

0 comments on commit 63fb815

Please sign in to comment.