neuroine
neuroine

Reputation: 331

Wordpress docker container with test e-mail environment

Is there any simple way to run Wordpress using the docker with the environment to test mailing?

I have a container with WordPress and MariaDB running and I am trying to connect it to MailDev or similar environment for the mailing test.

I have installed sendmail in the WordPress container

apt-get install -y sendmail sendmail-bin mailutils

I'm using the plugin WP Mail SMTP in which I set the "other SMTP" option. The plugin informs you that the mail has been sent, but nothing appears in MailDev.

Is there any solution to test e-mails locally?

Upvotes: 0

Views: 1077

Answers (1)

Kris Chase
Kris Chase

Reputation: 137

If you're on an Ubuntu environment, I'd highly recommend you go with Mailcatcher to troubleshoot and catch all your emails. It basically provides a nice GUI web interface for you to see all the emails that get sent out of your server.

https://mailcatcher.me/

   # Install dependencies
# older ubuntus
#apt-get install build-essential libsqlite3-dev ruby1.9.1-dev
# xenial
apt install build-essential libsqlite3-dev ruby-dev

# Install the gem
gem install mailcatcher --no-ri --no-rdoc

# Make it start on boot
echo "@reboot root $(which mailcatcher) --ip=0.0.0.0" >> /etc/crontab
update-rc.d cron defaults

# Make php use it to send mail
# older ubuntus
#echo "sendmail_path = /usr/bin/env $(which catchmail) -f 'www-data@localhost'" >> /etc/php5/mods-available/mailcatcher.ini
# xenial
echo "sendmail_path = /usr/bin/env $(which catchmail) -f 'www-data@localhost'" >> /etc/php/7.0/mods-available/mailcatcher.ini

# Notify php mod manager (5.5+)
# older ubuntus
#php5enmod mailcatcher
# xenial
phpenmod mailcatcher

# Start it now
/usr/bin/env $(which mailcatcher) --ip=0.0.0.0

Upvotes: 0

Related Questions