PHPMailer: our changes to an open source project
The classic PHP library for sending email, used by WordPress and many other systems.
- Language
- PHP
- GitHub stars
- 22,310
The changes merged into PHPMailer
The QUIT command no longer ends up in the body of an interrupted message, long address headers are folded, and S/MIME signatures have normalised line breaks.
- Pull request #3362merged on 4 October 2026
- Pull request #3361merged on 4 October 2026
Fold long address headers
github.com/PHPMailer/PHPMailer/pull/3361 - Pull request #3358merged on 10 September 2026
Normalise line breaks in S/MIME signed messages
github.com/PHPMailer/PHPMailer/pull/3358
How we tested #3362
A new test, testQuitDuringData, opens a connection, sends MAIL and RCPT, starts DATA without sending the message, as if the send had been interrupted, and calls quit(). It then checks the client debug output to confirm that QUIT was not sent and that the connection is closed.
The bug, the fix and the lesson
A summary of our Tech news write-up: what was broken, what we changed and what it means for our own work.
QUIT became a line of the message
When sending broke off after DATA and the application closed the connection with quit(), the server took QUIT as part of the email and never replied. The client waited until the time limit ran out.
quit() checks the connection state
The SMTP class remembers the last command it sent, and in the DATA state quit() just closes the connection without sending QUIT.
SMTP has states, and a command sent in the wrong one becomes part of the message.
When sending mail we always check the connection's state before closing it.
Other projects with our changes: PHP
20 projects in this technology have our merged changes. The bar is the repository's stars, next to it the number of our changes. Each row leads to the project's page.
Questions about our changes to PHPMailer
Where these changes come from, who merged them and whether we can fix something in your library.
Read next
More about this work and the other projects with our changes.
Using PHPMailer in your project?
If something in it does not work, we fix it at the source and leave a workaround until the release. We reply within an hour.