Make WordPress Core

Opened 8 months ago

Last modified 3 weeks ago

#63135 assigned feature request

Testing and Debugging WP_Mail related topics

Reported by: sirlouen's profile SirLouen Owned by: sirlouen's profile SirLouen
Milestone: Future Release Priority: normal
Severity: minor Version:
Component: Build/Test Tools Keywords: has-patch has-test-info
Focuses: Cc:

Description

How do you test and debug things related to WP_Mail with wordpress_develop?

Unless I'm missing something in the code, I think that having an optional runnable Mailhog instance could be pretty neat for testing and debugging purposes.

Maybe there are some other proposals or ideas that I would like to know, but meanwhile I will be uploading a patch with Mailhog idea.

Change History (24)

This ticket was mentioned in Slack in #core-test by sirlouen. View the logs.


8 months ago

This ticket was mentioned in PR #8555 on WordPress/wordpress-develop by @SirLouen.


8 months ago
#2

  • Keywords has-patch added

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

#3 @SirLouen
8 months ago

  • Keywords needs-testing has-testing-info added

Ready for testing

#4 @SergeyBiryukov
7 months ago

  • Milestone changed from Awaiting Review to 6.9

This ticket was mentioned in Slack in #core-test by sirlouen. View the logs.


6 months ago

#6 @wordpressdotorg
6 months ago

  • Keywords has-test-info added; has-testing-info removed

This ticket was mentioned in Slack in #core-test by sirlouen. View the logs.


6 months ago

This ticket was mentioned in Slack in #core-test by sirlouen. View the logs.


6 months ago

#9 @nikunj8866
6 months ago

  • Keywords needs-testing removed

Test Report

Description

This report validates whether the indicated patch works as expected.

Patch tested: https://github.com/WordPress/wordpress-develop/pull/8555

Environment

  • WordPress: 6.9-alpha-60093-src
  • PHP: 8.2.28
  • Server: nginx/1.27.5
  • Database: mysqli (Server: 8.4.5 / Client: mysqlnd 8.2.28)
  • Browser: Chrome 136.0.0.0
  • OS: Windows 10/11
  • Theme: Twenty Eleven 4.9
  • MU Plugins: None activated
  • Plugins:
    • Amazon S3 Email Testing 1.0.0
    • Test Reports 1.2.0

Actual Results

  1. ✅ Issue resolved with patch.

Supplemental Artifacts

https://ibb.co/WNw5yQWf

#10 @SirLouen
6 months ago

  • Keywords dev-feedback added

#11 @johnbillion
6 months ago

  • Version trunk deleted

#12 @audrasjb
5 months ago

  • Type changed from enhancement to feature request

#13 @SirLouen
4 months ago

  • Keywords needs-unit-tests added; dev-feedback removed

Switching into Mailpit. It providers a better API for testing.
I will set a little suite of integration tests to showcase this.

#14 @SirLouen
4 months ago

  • Component changed from Build/Test Tools to Mail

@mindctrl commented on PR #8555:


4 months ago
#15

@SirLouen is there anything left to do here?

@SirLouen commented on PR #8555:


4 months ago
#16

@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.

@mindctrl commented on PR #8555:


3 months ago
#17

@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.

@SirLouen commented on PR #8555:


3 months ago
#18

@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.

#19 @SirLouen
3 months ago

  • Milestone changed from 6.9 to Future Release

Moving into Future Release for the reasons stated above. No need to rush it for now.

#20 follow-up: @jorbin
3 months ago

  • Keywords close added

I think this may be a duplicate of #48060. While that originates with a different suggestion, the most recent on the ticket is for MailHog.

#21 in reply to: ↑ 20 @SirLouen
2 months ago

  • Component changed from Mail to Build/Test Tools
  • Keywords needs-unit-tests close removed
  • Milestone changed from Future Release to 6.9
  • Owner set to SirLouen
  • Status changed from new to assigned

Replying to jorbin:

I think this may be a duplicate of #48060. While that originates with a different suggestion, the most recent on the ticket is for MailHog.

Thanks for that one, it true, and it's good to see that it has been solicited and there is plenty of interested.

But this ticket is much more advanced in progression in all regards, so I'm going to be closing that in favor of this one. I'm moving back to 6.9, I really want to see this anytime soon. It's definitely a pain to test for the Mail component.

I've been using this for over 4 months (patching on demand). The switch from Mailhog to Mailpit is significantly favorable. Maybe some tweaking is required to be more compliant with the current state of docker-composer.yml, although we have to keep simple the container name to be easy to target with the PHPMailer SMTP injection.

#22 @SirLouen
2 months ago

#48060 was marked as a duplicate.

This ticket was mentioned in Slack in #core by sirlouen. View the logs.


7 weeks ago

#25 @wildworks
3 weeks ago

  • Milestone changed from 6.9 to Future Release

6.9 Beta1 will be released soon, but this ticket seems to be about improving core development itself. I don't think it's a necessary task for the 6.9 release, so I will change the milestone to Future Release again.

Note: See TracTickets for help on using tickets.