Make WordPress Core

Opened 2 years ago

Last modified 6 days ago

#41750 reopened enhancement

Update PHPMailer to 6.0

Reported by: Synchro Owned by:
Milestone: 5.4 Priority: normal
Severity: normal Version:
Component: External Libraries Keywords: has-patch needs-testing needs-dev-note early
Focuses: Cc:
PR Number:


PHPMailer 5.2 has now been deprecated and PHPMailer 6.0 has been released. Minimum requirements have been increased to PHP 5.5 and it now has a namespace, which will require changes in WP's use of it.

Attachments (2)

41750.diff (243.6 KB) - added by SergeyBiryukov 5 weeks ago.
41750.2.diff (242.1 KB) - added by desrosj 5 weeks ago.

Download all attachments as: .zip

Change History (18)

#1 @netweb
2 years ago

Related: #40472 Update PHPMailer to 5.2.25

cc @MattyRob

#3 @johnbillion
2 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to maybelater
  • Status changed from new to closed

As the WordPress project is a long way from requiring PHP 5.5 as a minimum, updating to PHPMailer 6 isn't on the cards, unless somebody wants to maintain a fork that's compatible with PHP 5.2.

Closing as maybelater. We'll get there eventually.

#4 @johnbillion
2 years ago

  • Version trunk deleted

#5 @ocean90
12 months ago

#45276 was marked as a duplicate.

#6 @SergeyBiryukov
5 weeks ago

  • Keywords needs-patch added
  • Milestone set to Future Release
  • Resolution maybelater deleted
  • Status changed from closed to reopened

Reopening. As of WordPress 5.2, PHP 5.6.20+ is required, so if that was the remaining limitation in upgrading, it shouldn't be a blocker anymore.

#7 @SergeyBiryukov
5 weeks ago

#45822 was marked as a duplicate.

5 weeks ago

#8 @SergeyBiryukov
5 weeks ago

  • Keywords has-patch needs-testing needs-dev-note added; needs-patch removed
  • Milestone changed from Future Release to 5.3

41750.diff seems to work in my testing, bumping PHPMailer to the latest release, 6.0.7 at the moment.

Per the Stack Overflow thread and upgrading notes, the biggest change for us is probably the introduction of the PHPMailer\PHPMailer\PHPMailer namespace:

The reason this class ends up with this "triple name" is because it's the PHPMailer class, in the PHPMailer project, owned by the PHPMailer organisation. This allows it to be differentiated from other forks of PHPMailer, other projects by the PHPMailer organisation, and other classes within the project.

With enough testing and a dev note, I think this can still make it into 5.3.

5 weeks ago

#9 @desrosj
5 weeks ago

41750.2.diff updates the MockPHPMailer class to extend the PHPMailer class at the correct new namespace.

Also, it looks like PHPMailer now includes its own Exception class that is used by default. The only thing that class does is wrap exception messages in HTML. 41750.2.diff adds a preceding \ to all Exception occurrences to use the globally namespaced Exception instead.

There are still some unit test failures that need to be investigated.

#10 @Synchro
5 weeks ago

FWIW, I'm, very happy to see this update going ahead, thanks for getting it into WP! Is there anything you need help with?

Last edited 5 weeks ago by Synchro (previous) (diff)

#11 @SergeyBiryukov
4 weeks ago

#48072 was marked as a duplicate.

#12 @Hareesh Pillai
4 weeks ago

  • Component changed from Mail to External Libraries

#13 @davidbaumwald
4 weeks ago

@desrosj Is this something that make it in for Beta 1 of version 5.3 tomorrow, or do the test failures still need investigating?

#14 @desrosj
4 weeks ago

  • Milestone changed from 5.3 to 5.4

I think we should play this one safe and punt. @SergeyBiryukov if you feel otherwise, feel free to move it back.

#15 follow-up: @Synchro
4 weeks ago

I'm not sure when your deadline is for 5.3, but there are some reasonably important bug fixes in the pipeline for PHPMailer.

#16 in reply to: ↑ 15 @jrf
6 days ago

  • Keywords early added

Replying to Synchro:

I'm not sure when your deadline is for 5.3, but there are some reasonably important bug fixes in the pipeline for PHPMailer.

@Synchro Hi Marcus, sorry that nobody replied to you before, but WP 5.3 has already gone into feature freeze.

An upgrade like this will need plenty of testing as the impact could be large if not done 100% correctly, not just for WP itself, but also for plugins/themes using the functionality provided via WP, so should preferably be made early in a release cycle.

Note: See TracTickets for help on using tickets.