Soluto / wordpress-plugin-tests-template

A template for a Wordpress plugin with tests that are running using Docker

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Make sending emails work

Richi2293 opened this issue · comments

Hi,

is it possible to make sending mail work?

I have in my code the 'wp_mail' method of wordpress to send emails and I would like to make it work so as to test also sending the emails.
Because it would seem that this thing doesn't work.

Thanks


maybe it could be a solution to use the basic wordpress part this image that I think already has the functionality:
https://github.com/sjitech/wordpress-sendmail

To be honest, I'm not sure. IMO it is better to just test this method is working. But I would guess that in order to make it work also here, you probably need to configure WordPress with the relevant details so it could send mail. How do you configure regular WP instance? This could help us figure it out.

On my wordpress test environment I used this plugin: https://it.wordpress.org/plugins/wp-mail-smtp/
With that plugin I set up a gmail email who requested this information to work: SMTP Host, SMTP Port,
Encryption set to ssl, Authentication SMTP.

So you will need to customize the Dockerfile to install this plugin and set up all those settings in order for this to work. Not very complicated, but somewhat flaky.
IMO it is better to test that the method was called, this thread looks pretty promising, but there was also many other options online. This will be a lot less flaky, and not depend on external plugin and SMTP server to work.

We're archiving the repository but keeping it online in case it's helpful for others. As part of that we're closing the open issues and pull requests.