Override PHP Mail for Mailpoet (via wp_mail)

Description

By default, MailPoet sends emails via PHP Mail, its premium MailPoet Sending Service, or services like Amazon SES or SendGrid. But there’s a catch: Some SMTP providers (like Gmail) aren’t supported, and email logging isn’t possible.

This plugin fixes that. It ensures all MailPoet newsletters are sent via your chosen SMTP plugin, so your WordPress email settings apply to newsletters, too – without extra setup or extra costs.

🛠 Works with popular SMTP plugins like:

WP Mail SMTP (by WPForms – the most widely used SMTP plugin)
FluentSMTP (lightweight, free, GDPR-friendly)
Post SMTP (supports OAuth for Gmail, Outlook, etc.)
Easy WP SMTP (simple & reliable)
MailerSend, Brevo (formerly Sendinblue), and more

🎯 Why use this plugin?

Ensures MailPoet emails follow your SMTP settings
Works with Gmail & other SMTP providers MailPoet doesn’t support
Enables email logging via your SMTP plugin

⚠ Important notes:

  • Major MailPoet updates may require adjustments.
  • Some advanced MailPoet features (like bounce handling) may behave differently.

Test your setup with MailPoet test emails and real newsletters to ensure everything runs smoothly!

Installation

  1. Download or clone this plugin into your /wp-content/plugins/ directory.
  2. Make sure the folder is named something like omppm-override-phpmail-mailpoet.
  3. Go to Plugins in your WordPress admin area and activate Override PHP Mail for Mailpoet (via wp_mail).
  4. In MailPoet > Settings, choose “Server (Standard)” or “PHP mail” as your sending method (so it normally uses PHPMail).
  5. 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.
  6. 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

08 Fevral 2025 1 reply
I must admit, I was surprised to learn that I wasn’t able to log my SMTP traffic using vanilla Mailpoet out of the box. I’ve been using several SMTP plugins over the years, and they are in reality mandatory if you want to ensure predictable delivery of emails sent from the web server, including SSL encryption and authentication. Not to forget logging, which is crucial to debug any delivery issues. I’ve tested Override PHP Mail for Mailpoet with FluentSMTP and so far it works perfectly. All outgoing mail is now being logged and can be monitored within the dashboard. To make sure I have a fallback available, I did the following: first I set up the standard Mailpoet SMTP sending method, including its settings for SMTP host name, port, username, password and SSL, and made sure that worked. then I configured FluentSMTP with the same SMTP settings, and made sure that worked too. finally, I switched Mailpoet send with from SMTP to Your web host / web server (php), and performed a final test, including checking the newsletter was logged in FluentSMTP. It was. That way, should the override fail, I should be able to disable the plugin and toggle Mailpoet back to SMTP and carry on as usual, albeit without the logging. Nice work, and thank you so much for sharing ⭐⭐⭐⭐⭐
Read all 1 review

Contributors & Developers

“Override PHP Mail for Mailpoet (via wp_mail)” is open source software. The following people have contributed to this plugin.

Contributors

Changelog

= 1.0.3

Veröffentlichungsdatum: 19. Februar 2025

  • Readme.txt updated.

= 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