wordpress-develop icon indicating copy to clipboard operation
wordpress-develop copied to clipboard

Adding Mailhog Support

Open SirLouen opened this issue 8 months ago • 2 comments

Adding support for a mailhog container on demand with the env variable: LOCAL_MAILHOG

Patch Testing instructions:

  1. Change LOCAL_MAILHOG=false to LOCAL_MAILHOG=true in your .env file
  2. Run your docker environment as usual npm run env:start
  3. You test if your mailhog instance is running with either: A) Go to http://localhost:8025/ B) You can run in your wordpress-develop container
docker exec -it  wordpress-develop-php-1 openssl s_client -connect mailhog:1025

And it might result in something like:

CONNECTED(00000003)
135865530688832:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:../ssl/record/ssl3_record.c:331:
---
no peer certificate available
---
No client certificate CA names sent
---
SSL handshake has read 5 bytes and written 283 bytes
Verification: OK
---
New, (NONE), Cipher is (NONE)
Secure Renegotiation IS NOT supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
Early data was not sent
Verify return code: 0 (ok)

C) You can do further tests, like sending an email with a plugin that uses the local mailhog hostname For example this one: https://github.com/SirLouen/amazon-s3-email-testing/archive/refs/tags/1.0.0.zip

Trac ticket: https://core.trac.wordpress.org/ticket/63135


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

SirLouen avatar Mar 20 '25 16:03 SirLouen

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props sirlouen, mindctrl.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

github-actions[bot] avatar Mar 20 '25 16:03 github-actions[bot]

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • The Plugin and Theme Directories cannot be accessed within Playground.
  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance, it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

github-actions[bot] avatar Mar 20 '25 17:03 github-actions[bot]

@SirLouen is there anything left to do here?

mindctrl avatar Jul 25 '25 13:07 mindctrl

@mindctrl yeah this is still of phase 1. But I'm using this mainly to drag it as a patch and test reports that need something relating with Mail component. I don't think it will get through as-is right now.

SirLouen avatar Jul 25 '25 14:07 SirLouen

@SirLouen could you add a list of things left to do in the opening description? We have a 6.9 milestone and I'd love to help get it in the proper state for a committer to review/merge. I've needed local mail testing multiple times recently. WCUS Contributor Day is coming up and I know a few people willing to help.

mindctrl avatar Aug 20 '25 18:08 mindctrl

@mindctrl I think it's time to de-milestone this. I was confident that this could be a great addition to wordpress-develop, but for now it's not adding value in the line that is expected (according to one dev-chat some months ago)

My idea is to look to add extra value to this, but this is not going to happen anytime soon, and I seriously doubt it will make it on time for 6.9. This PR by itself is useful for someone like me that uses this PR like every other day, but useless for most of the people that seldom test anything—mail. Hope to see it merged somewhere in the future, but much work is needed to consider it a potential merge (mainly creating integration tests in PHPUnit that make use of this service).

I've updated the milestone so we don't need to rush it anymore.

SirLouen avatar Aug 20 '25 22:08 SirLouen