Skip to content

This is a WordPress test stack including the ability to inspect emails.

License

Notifications You must be signed in to change notification settings

muhme/wordpress-maildev

Repository files navigation

WordPress with Email

This is a docker stack for testing WordPress (e.g. as base to clone a LIVE instance) including the ability to check mails and work with the database. Last time tested in November 2023 with WordPress 6.4.1.

You can check the mails from WordPress with MailDev, a SMTP server with web interface. msmtp is used as a simple SMPT client.

A small WordPress plugin sets the sender email address (from field) fixed to 'webmaster@docker.local' and fixes the problem of undeliverable address 'wordpress@localhost' inside Docker container. Installing it as must-use WordPress plugin to have it already actived.

mails

Database administration is realised with the well known phpMyAdmin.

Installation

git clone https://github.com/muhme/wordpress-maildev
cd wordpress-maildev
docker compose up -d

Running the docker compose command creates four containers:

  • wp_wordpress – WordPress CMS
    • http://localhost:3080 – WordPress instance, ready for installation
    • WordPress files are available mapped to docker host in directory 'wp'
  • wp_mariadb – MariaDB database
    • database available as mysql:3306
    • user 'root', password 'root' and database 'wordpress'
  • wp_phpmyadmin – phpmyadmin database administration app
  • wp_maildev - MailDev for collecting and displaying emails

All four containers are used in the latest version.

docker

Testing

You can test mails from WordPress after the initial installation click the "Forgot your password?" feature at http://localhost:3080/wp-login.php and check afterwards MailDev on http://localhost:3082

For the following two tests, you need to go into the Docker container:

host$ docker exec -it wp_wordpress bash

You can test msmtp inside container with:

wp_wordpress# echo -e "Subject: Test Mail\r\nTo: you@test.com\r\n\r\nEverything working?" | msmtp --debug -f me@test.com -- you@test.com

You can test PHP email configuration inside container with:

wp_wordpress# php -r "mail('you@test.com','Test Mail from PHP', 'Working too?', 'From: me@test.com');"

Clean-Up

To stop and remove Docker containers and networks:

docker compose down

License

This project is licensed under the MIT License.

Contact

Don't hesitate to ask if you have any questions or comments.

About

This is a WordPress test stack including the ability to inspect emails.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published