#63135 closed feature request (wontfix)
Testing and Debugging WP_Mail related topics
| Reported by: | SirLouen | Owned by: | SirLouen |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Build/Test Tools | Version: | |
| Severity: | minor | Keywords: | has-patch has-test-info |
| Cc: | Focuses: |
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 (26)
This ticket was mentioned in Slack in #core-test by sirlouen. View the logs.
20 months ago
This ticket was mentioned in PR #8555 on WordPress/wordpress-develop by @SirLouen.
20 months ago
#2
- Keywords has-patch added
This ticket was mentioned in Slack in #core-test by sirlouen. View the logs.
18 months ago
This ticket was mentioned in Slack in #core-test by sirlouen. View the logs.
18 months ago
This ticket was mentioned in Slack in #core-test by sirlouen. View the logs.
18 months ago
#9
@
18 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
- ✅ Issue resolved with patch.
Supplemental Artifacts
#13
@
16 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.
@mindctrl commented on PR #8555:
16 months ago
#15
@SirLouen is there anything left to do here?
@SirLouen commented on PR #8555:
16 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:
15 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:
15 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
@
15 months ago
- Milestone 6.9 → Future Release
Moving into Future Release for the reasons stated above. No need to rush it for now.
#20
follow-up:
↓ 21
@
15 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
@
14 months ago
- Component Mail → Build/Test Tools
- Keywords needs-unit-tests close removed
- Milestone Future Release → 6.9
- Owner set to
- Status new → 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.
This ticket was mentioned in Slack in #core by sirlouen. View the logs.
13 months ago
#25
@
13 months ago
- Milestone 6.9 → 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.
#26
@
11 months ago
- Milestone Future Release
- Resolution → wontfix
- Status assigned → closed
With this in place #63564 and docker-composer.override.yml this is not necessary anymore.
#27
@
5 weeks ago
@johnbillion @desrosj @jorbin can we reconsider this request?
I recently had the need to test the user / administration emails change flows in the admin. I had to do some extra work just to test the sent emails. The developer experience should be effortless when testing features involving emails and should not require extra steps.
I ended up using docker-compose.override.yml to add the Mailpit container, using basically the same config used in https://github.com/WordPress/wordpress-develop/pull/8555
Then, I had to use a small plugin to:
- Hook into
wp_mail_fromto force WordPress to generate a valid domain pattern for the From address. - More importantly: hook into
phpmailer_initto route the local emails to the Mailpit container.
All of the above should not be required just to test Core features.
The request for a mail catcher container seems to be pretty common, see #49305 and #48060.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Adding support for a mailhog container on demand with the env variable:
LOCAL_MAILHOGPatch Testing instructions:
LOCAL_MAILHOG=falsetoLOCAL_MAILHOG=truein your.envfilenpm run env:startA) Go to http://localhost:8025/
B) You can run in your wordpress-develop container
And it might result in something like:
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