Description
This plugin overrides MailPoet’s default “PHPMail” sending method. By default, MailPoet calls PHPMailer->isMail()
, which relies on PHP’s native mail()
function. That approach can bypass your WordPress SMTP plugin settings.
Override PHP Mail for Mailpoet (via wp_mail) forces MailPoet to use wp_mail()
for sending. This ensures that your configured SMTP method (for example, via the WP Mail SMTP plugin, or other solutions) is applied to all outgoing newsletters—even if MailPoet’s sending method is set to “Server (Standard)” or “PHP mail”.
Key Features:
* Replaces MailPoet’s PHPMail
class using a class alias technique.
* Calls wp_mail()
, so WP Mail SMTP or other custom mail hooks can handle the actual sending.
* Avoids the direct $mailer->send()
path, ensuring all MailPoet emails pass through the standard WordPress mail pipeline.
Important:
* This is a hack solution and may break with future MailPoet updates (especially major version changes).
* Some MailPoet features (like bounce handling or advanced tracking) may not behave exactly as expected, since the original PHPMailer
flow is modified.
* Always test thoroughly (including the MailPoet test emails AND real newsletter sends).
Installation
- Download or clone this plugin into your
/wp-content/plugins/
directory. - Make sure the folder is named something like
omppm-override-phpmail-mailpoet
. - Go to Plugins in your WordPress admin area and activate Override PHP Mail for Mailpoet (via wp_mail).
- In MailPoet > Settings, choose “Server (Standard)” or “PHP mail” as your sending method (so it normally uses
PHPMail
). - Configure your SMTP method in WP Mail SMTP (or your preferred SMTP plugin).
- If you’re using Gmail API or another specialized flow, ensure it’s properly set up in WP Mail SMTP.
- Send a test newsletter (or use the MailPoet test mail) and verify via WP Mail SMTP logs or email headers that the mail goes through your desired SMTP provider.
FAQ
-
Does this plugin replace MailPoet’s default sending method completely?
-
Yes. For all newsletters and test emails that would normally use “PHPMail,” it redirects to
wp_mail()
. However, if you are using MailPoet’s own “MailPoet Sending Service” or “SendGrid,” those remain unaffected. -
Will this plugin work with MailPoet 4, 5, or future versions?
-
It has been tested with MailPoet 5.x. MailPoet may change internal classes or architecture in future updates, which could break this override approach. We recommend testing on a staging site whenever you update MailPoet.
-
What if my emails still seem to go out via `mail()`?
-
- Double-check that you have the correct sending method set in MailPoet (“Server” / “PHP mail”), not an external SMTP inside MailPoet’s own configuration.
- Verify that WP Mail SMTP (or any other SMTP plugin) is active and configured.
- Check if the MailPoet test emails differ from real newsletter sends. Sometimes the test mail can take a different route.
-
Does this plugin require code changes in MailPoet?
-
No. But internally, it uses a “class alias” hack to replace MailPoet’s
PHPMail
class on the fly, which can be update-sensitive. If you see errors or your newsletter fails after a MailPoet update, deactivate and re-check plugin compatibility.
Reviews
Contributors & Developers
“Override PHP Mail for Mailpoet (via wp_mail)” is open source software. The following people have contributed to this plugin.
ContributorsTranslate “Override PHP Mail for Mailpoet (via wp_mail)” into your language.
Interested in development?
Browse the code, check out the SVN repository, or subscribe to the development log by RSS.
Changelog
= 1.0.2
Veröffentlichungsdatum: 04. Februar 2025
- Added a check for the email type to ensure that only real MailPoet emails are redirected.
= 1.0.1
Veröffentlichungsdatum: 23. Januar 2025
- Polished readme.txt and main plguin file headers.
= 1.0.0
Veröffentlichungsdatum: 15. Januar 2025
- Erstveröffentlichung