Skip to content

Conversation

@edanzer
Copy link
Contributor

@edanzer edanzer commented Nov 12, 2025

Fixes FORMS-392 and FORMS-374

Proposed changes:

This PR updates our code for adding subscribers to MailPoet. Before we'd just immediately call the API method to add a new subscriber. But this misses several different possible situations. Now we check if the subscriber exists and take different results based on subscriber status.

  • If subscriber exists and is on the target list, we do nothing
  • If subscriber exists and is not on the target list, we add the subscriber to the list using $mailpoet_api->subscribeToLists
    • In this case, we also check if the subscriber has already confirmed their email. If so, we set send_confirmation_email to false so we do not send repeat confirmation emails.
  • If subscriber does not exist, we add the subscriber as before (which also means leaving send_confirmation_email as default to true, so confirmation email will go out.

Other information:

  • Have you written new tests for your changes, if applicable?
  • Have you checked the E2E test CI results, and verified that your changes do not break them?
  • Have you tested your changes on WordPress.com, if applicable (if so, you'll see a generated comment below with a script to run)?

Jetpack product discussion

See linear issue above.
Also see Slack: p1762546356789039-slack-C0313FPUG74

Does this pull request change what data or activity we track or use?

No.

Testing instructions:

  • Setup.

    • Jurassic Ninja. To test emails, you'll need to be on a test site where you can configure MailPoet to send confirmation emails. I was unable to do this on my usual Jurassic tube testing site. The cleanest way to test this is to create a Jurrasic Ninja site with Jetpack, MailPoet, and Jetpack Beta Tester installed.
    • Jetpack Beta Tester: load this branch for Jetpack
    • MailPoet: For sending email, you'll need a free MailPoet account with key, and you'll need to go to MailPoet > Settings > Send with and add your MailPoet key to use the MailPoet sending service to send emails.
      • Once set up, go to MailPoet > Lists and create two unique subscriber lists (ie, like First List, Second List).
    • Email Address: You also need to be able to submit forms as a user with a unique email. You can use https://temp-mail.org/ to set up a temporary inbox to use.
  • Testing.

    • Add a form to a post. Be sure to add First and Last Name field variations, plus Email.
    • Open the integrations modal, enable MailPoet, and select one of your two unique lists.
    • Publish your form, submit on the frontend.
    • Go to MailPoet > Subscribers, and confirm user is added to list.
    • Initially, a user's status will be 'unconfirmed'. Whatever email you used, go to your inbox, confirm you received a confirmation email, and click to confirm.
    • Refresh the MailPoet > Subscribers page and confirm your user now has status of 'subscribed'.
    • Now go back to your post with the form, and update the form to use the second MailPoet list you set up.
    • Publish and re-submit the form using the same name and email.
    • Refresh MailPoet > Subscribers and confirm your subscriber is now added to both lists.
    • Go to your email inbox and confirm you do not get a second confirmation email.
    • As an extra test, try resubmitting your form once more with all the same details. The submission should be successful, you should see a third form submission in your forms inbox, but nothing will change with your MailPoet subscriber, and no confirmation email will be received by the subscriber.

@edanzer edanzer self-assigned this Nov 12, 2025
@edanzer edanzer added [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it [Status] Needs Review This PR is ready for review. [Pri] Normal [Block] Contact Form Form block (also see Contact Form label) [Package] Forms labels Nov 12, 2025
@edanzer edanzer marked this pull request as ready for review November 12, 2025 18:11
@github-actions
Copy link
Contributor

github-actions bot commented Nov 12, 2025

Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.

  • To test on WoA, go to the Plugins menu on a WoA dev site. Click on the "Upload" button and follow the upgrade flow to be able to upload, install, and activate the Jetpack Beta plugin. Once the plugin is active, go to Jetpack > Jetpack Beta, select your plugin (Jetpack), and enable the update/forms-mailpoet-subscriber-confirmation branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack update/forms-mailpoet-subscriber-confirmation

Interested in more tips and information?

  • In your local development environment, use the jetpack rsync command to sync your changes to a WoA dev blog.
  • Read more about our development workflow here: PCYsg-eg0-p2
  • Figure out when your changes will be shipped to customers here: PCYsg-eg5-p2

@github-actions github-actions bot added [Feature] Contact Form [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Status] In Progress labels Nov 12, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Nov 12, 2025

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Review, ...).
  • ✅ Add a "[Type]" label (Bug, Enhancement, Janitorial, Task).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


Follow this PR Review Process:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Make sure to test your changes on all platforms that it applies to. You're responsible for the quality of the code you ship.
  3. You can use GitHub's Reviewers functionality to request a review.
  4. When it's reviewed and merged, you will be pinged in Slack to deploy the changes to WordPress.com simple once the build is done.

If you have questions about anything, reach out in #jetpack-developers for guidance!


Jetpack plugin:

The Jetpack plugin has different release cadences depending on the platform:

  • WordPress.com Simple releases happen as soon as you deploy your changes after merging this PR (PCYsg-Jjm-p2).
  • WoA releases happen weekly.
  • Releases to self-hosted sites happen monthly:
    • Scheduled release: December 2, 2025

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.

@jp-launch-control
Copy link

jp-launch-control bot commented Nov 12, 2025

Code Coverage Summary

Coverage changed in 1 file.

File Coverage Δ% Δ Uncovered
projects/packages/forms/src/service/class-mailpoet-integration.php 5/144 (3.47%) -0.43% 16 💔

Full summary · PHP report · JS report

If appropriate, add one of these labels to override the failing coverage check: Covered by non-unit tests Use to ignore the Code coverage requirement check when E2Es or other non-unit tests cover the code Coverage tests to be added later Use to ignore the Code coverage requirement check when tests will be added in a follow-up PR I don't care about code coverage for this PR Use this label to ignore the check for insufficient code coveage.

@edanzer edanzer merged commit a4ab260 into trunk Nov 13, 2025
76 of 91 checks passed
@edanzer edanzer deleted the update/forms-mailpoet-subscriber-confirmation branch November 13, 2025 16:38
@github-actions github-actions bot removed [Status] Needs Review This PR is ready for review. [Status] In Progress labels Nov 13, 2025
@github-actions github-actions bot added this to the jetpack/15.3 milestone Nov 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Block] Contact Form Form block (also see Contact Form label) [Feature] Contact Form [Package] Forms [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Pri] Normal [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants