{"id":20742652,"url":"https://github.com/itinerisltd/wp-phpmailer","last_synced_at":"2026-02-27T09:45:05.027Z","repository":{"id":34640061,"uuid":"177319509","full_name":"ItinerisLtd/wp-phpmailer","owner":"ItinerisLtd","description":"Provides a clean and simple way to configure the WordPress-bundled PHPMailer library, allowing you to quickly get started sending mail through a local or cloud based service of your choice","archived":false,"fork":false,"pushed_at":"2023-04-19T21:16:43.000Z","size":998,"stargazers_count":61,"open_issues_count":6,"forks_count":6,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-05-10T23:03:44.626Z","etag":null,"topics":["mailhog","mailtrap","office365","phpmailer","sendgrid","smtp","wordpress","wordpress-plugin"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ItinerisLtd.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-03-23T17:29:39.000Z","updated_at":"2024-12-12T23:17:42.000Z","dependencies_parsed_at":"2024-08-03T13:14:02.337Z","dependency_job_id":null,"html_url":"https://github.com/ItinerisLtd/wp-phpmailer","commit_stats":{"total_commits":470,"total_committers":9,"mean_commits":52.22222222222222,"dds":"0.15957446808510634","last_synced_commit":"583c8f6c5bae016bea8ff11c9ad4c4133d789c0f"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ItinerisLtd%2Fwp-phpmailer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ItinerisLtd%2Fwp-phpmailer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ItinerisLtd%2Fwp-phpmailer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ItinerisLtd%2Fwp-phpmailer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ItinerisLtd","download_url":"https://codeload.github.com/ItinerisLtd/wp-phpmailer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253492709,"owners_count":21916972,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["mailhog","mailtrap","office365","phpmailer","sendgrid","smtp","wordpress","wordpress-plugin"],"created_at":"2024-11-17T07:06:48.655Z","updated_at":"2026-02-27T09:45:04.964Z","avatar_url":"https://github.com/ItinerisLtd.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# WP PHPMailer\n\n[![CircleCI](https://circleci.com/gh/ItinerisLtd/wp-phpmailer.svg?style=svg)](https://circleci.com/gh/ItinerisLtd/wp-phpmailer)\n[![Packagist Version](https://img.shields.io/packagist/v/itinerisltd/wp-phpmailer.svg?label=release\u0026style=flat-square)](https://packagist.org/packages/itinerisltd/wp-phpmailer)\n[![WordPress Plugin Rating](https://img.shields.io/wordpress/plugin/rating/wp-phpmailer?style=flat-square)](https://wordpress.org/plugins/wp-phpmailer)\n[![PHP from Packagist](https://img.shields.io/packagist/php-v/itinerisltd/wp-phpmailer.svg?style=flat-square)](https://packagist.org/packages/itinerisltd/wp-phpmailer)\n[![WordPress Plugin: Tested WP Version](https://img.shields.io/wordpress/plugin/tested/wp-phpmailer?style=flat-square)](https://wordpress.org/plugins/wp-phpmailer)\n[![Packagist Downloads](https://img.shields.io/packagist/dt/itinerisltd/wp-phpmailer.svg?label=packagist%20downloads\u0026style=flat-square)](https://packagist.org/packages/itinerisltd/wp-phpmailer/stats)\n[![WordPress Plugin Downloads](https://img.shields.io/wordpress/plugin/dt/wp-phpmailer?label=wp.org%20downloads\u0026style=flat-square)](https://wordpress.org/plugins/wp-phpmailer/advanced/)\n[![GitHub License](https://img.shields.io/github/license/itinerisltd/wp-phpmailer.svg?style=flat-square)](https://github.com/ItinerisLtd/wp-phpmailer/blob/master/LICENSE)\n[![Hire Itineris](https://img.shields.io/badge/Hire-Itineris-ff69b4.svg?style=flat-square)](https://www.itineris.co.uk/contact/)\n[![Twitter Follow @itineris_ltd](https://img.shields.io/twitter/follow/itineris_ltd?style=flat-square\u0026color=1da1f2)](https://twitter.com/itineris_ltd)\n[![Twitter Follow @TangRufus](https://img.shields.io/twitter/follow/TangRufus?style=flat-square\u0026color=1da1f2)](https://twitter.com/tangrufus)\n\n\n[WP PHPMailer](https://github.com/ItinerisLtd/wp-phpmailer) provides a clean and simple way to configure [the WordPress-bundled PHPMailer library](https://core.trac.wordpress.org/browser/trunk/src/wp-includes/class-phpmailer.php), allowing you to quickly get started sending mail through a local or cloud based service of your choice.\n\n\u003c!-- START doctoc generated TOC please keep comment here to allow auto update --\u003e\n\u003c!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --\u003e\n\n\n- [Goal](#goal)\n- [Usage](#usage)\n  - [Mailhog](#mailhog)\n  - [Mailtrap](#mailtrap)\n  - [SendGrid](#sendgrid)\n- [Custom Driver](#custom-driver)\n  - [Step 1. Define Your Driver](#step-1-define-your-driver)\n  - [Step 2. Register Your Driver](#step-2-register-your-driver)\n  - [Step 3. Define Constants](#step-3-define-constants)\n- [Filters](#filters)\n  - [`wp_phpmailer_driver`](#wp_phpmailer_driver)\n  - [`wp_phpmailer_drivers`](#wp_phpmailer_drivers)\n  - [`wp_phpmailer_config_mappings`](#wp_phpmailer_config_mappings)\n- [Minimum Requirements](#minimum-requirements)\n- [Installation](#installation)\n  - [Composer (Recommended)](#composer-recommended)\n  - [wordpress.org (WP CLI)](#wordpressorg-wp-cli)\n  - [wordpress.org](#wordpressorg)\n  - [Build from Source (Not Recommended)](#build-from-source-not-recommended)\n- [Common Errors](#common-errors)\n  - [`NotFoundException` - `Driver 'xxx' not found, acceptable values are: aaa, bbb, ccc`](#notfoundexception---driver-xxx-not-found-acceptable-values-are-aaa-bbb-ccc)\n- [FAQ](#faq)\n  - [Where is the settings page?](#where-is-the-settings-page)\n  - [Will you add a settings page?](#will-you-add-a-settings-page)\n  - [What PHPMailer version bundled?](#what-phpmailer-version-bundled)\n  - [Is it a must to use SMTP?](#is-it-a-must-to-use-smtp)\n  - [Will you add support for older PHP versions?](#will-you-add-support-for-older-php-versions)\n  - [It looks awesome. Where can I find more goodies like this?](#it-looks-awesome-where-can-i-find-more-goodies-like-this)\n  - [Where can I give :star::star::star::star::star: reviews?](#where-can-i-give-starstarstarstarstar-reviews)\n- [Testing](#testing)\n- [Feedback](#feedback)\n- [Security](#security)\n- [Credits](#credits)\n- [License](#license)\n\n\u003c!-- END doctoc generated TOC please keep comment here to allow auto update --\u003e\n\n## Goal\n\nAlthough WordPress bundles [the PHPMailer library](https://core.trac.wordpress.org/browser/trunk/src/wp-includes/class-phpmailer.php) which allow you sending mail through a local or cloud based service of your choice, different cloud based service requires different configuration.\nWorse still, most services provide multiple ways for setting them up. For instance: which [SendGrid](https://sendgrid.com/) SMTP port provides the highest level of security, `25`, `587`, `2525` or `465`?\n\n[WP PHPMailer](https://github.com/ItinerisLtd/wp-phpmailer) uses [the WordPress-bundled PHPMailer library](https://core.trac.wordpress.org/browser/trunk/src/wp-includes/class-phpmailer.php):\n\n- so you offload the responsibility of updating bundled libraries from plugin authors to WordPress core team and contributors\n  * at the time of writing, the official SendGrid plugin's [vendor folder](https://github.com/sendgrid/wordpress/tree/master/vendor) hasn't been updated in 2.5 years\n\n[WP PHPMailer](https://github.com/ItinerisLtd/wp-phpmailer) believes in [convention over configuration](https://rubyonrails.org/doctrine/#convention-over-configuration), we pick the best configuration for each service:\n\n- so you don't waste time going through the documents\n- so you don't have to figure out which port and protocol to use\n- so you don't miss any security configuration, e.g: `SMTPAuth`, `SMTPSecure`, etc\n  * unlike [the official Mailgun plugin](https://wordpress.org/plugins/mailgun/), there is no \"use secure SMTP\" option because nobody should be using insecure options\n- so you only have to provide minimum information\n  * take SendGrid for example, only SendGrid API key (with \"Mail Send\" permission only) is required\n\n[WP PHPMailer](https://github.com/ItinerisLtd/wp-phpmailer) believes a plugin should [\"do one thing and do it well\"](https://en.wikipedia.org/wiki/Unix_philosophy#Do_One_Thing_and_Do_It_Well):\n\n- unlike [the official SendGrid plugin](https://wordpress.org/plugins/sendgrid-email-delivery-simplified/), [WP PHPMailer](https://github.com/ItinerisLtd/wp-phpmailer) doesn't include the subscription widget nor the stats dashboard\n\n## Usage\n\nPick one driver and define its required constants in `wp-config.php`.\n\n### Mailhog\n\n```php\ndefine('WP_PHPMAILER_DRIVER', 'mailhog');\n```\n\n### Mailtrap\n\n```php\ndefine('WP_PHPMAILER_DRIVER', 'mailtrap');\n\ndefine('MAILTRAP_USERNAME', 'your-mailtrap-username');\ndefine('MAILTRAP_PASSWORD', 'your-mailtrap-password');\n```\n\n### SendGrid\n\n```php\ndefine('WP_PHPMAILER_DRIVER', 'sendgrid');\n\ndefine('SENDGRID_API_KEY', 'your-sendgrid-api-key');\n\n// Optional. Useful if you have email authentication configurated.\ndefine('SENDGRID_FROM_ADDRESS', 'you@example.test');\ndefine('SENDGRID_FROM_NAME', 'John Doe');\ndefine('SENDGRID_FROM_AUTO', true);\n```\n\n## Custom Driver\n\n### Step 1. Define Your Driver\n\n```php\nclass MyCustomDriver implements DriverInterface\n{\n    public static function makeConfig(ConstantRepository $constantRepo): ConfigInterface\n    {\n        $config = new Config();\n\n        $config-\u003eset('auth', true);\n        $config-\u003eset('host', 'smtp.custom.test');\n        $config-\u003eset('port', 587);\n        $config-\u003eset('protocol', 'tls');\n\n        $config-\u003eset(\n            'username',\n            $constantRepo-\u003egetRequired('MY_CUSTOM_USERNAME')\n        );\n\n        $config-\u003eset(\n            'password',\n            $constantRepo-\u003egetRequired('MY_CUSTOM_PASSWORD')\n        );\n\n        $config-\u003eset(\n            'fromAddress',\n            $constantRepo-\u003eget('MY_CUSTOM_FROM_ADDRESS')\n        );\n        $config-\u003eset(\n            'fromName',\n            $constantRepo-\u003eget('MY_CUSTOM_FROM_NAME')\n        );\n        $config-\u003eset(\n            'fromAuto',\n            $constantRepo-\u003eget('MY_CUSTOM_FROM_AUTO')\n        );\n\n        return $config;\n    }\n}\n```\n\n### Step 2. Register Your Driver\n\n```php\nadd_filter('wp_phpmailer_drivers', function (array $drivers): array {\n    $drivers['my-custom-driver'] = MyCustomDriver::class;\n\n    return $drivers;\n});\n```\n\n### Step 3. Define Constants\n\n```php\n// wp-config.php\n\ndefine('WP_PHPMAILER_DRIVER', 'my-custom-driver');\n\ndefine('MY_CUSTOM_USERNAME', 'xxx');\ndefine('MY_CUSTOM_PASSWORD', 'xxx');\n\n// Optional.\ndefine('MY_CUSTOM_FROM_ADDRESS', 'xxx');\ndefine('MY_CUSTOM_FROM_NAME', 'xxx');\ndefine('MY_CUSTOM_FROM_AUTO', true);\n```\n\n## Filters\n\n### `wp_phpmailer_driver`\n\n`$driver = (string) apply_filters('wp_phpmailer_driver', string $wpPhpmailerDriver))`\n\nFilters the `WP_PHPMAILER_DRIVER` constant.\n\nParameters:\n\n- $wpPhpmailerDriver\n  * (_string_) the value of `WP_PHPMAILER_DRIVER` constant\n\n### `wp_phpmailer_drivers`\n\n`$drivers = (array) apply_filters('wp_phpmailer_drivers', array $drivers)`\n\nFilters the available drivers array.\n\nParameters:\n\n- $drivers\n  * (_array_) the available drivers array\n\nExample:\n\n ```php\nadd_filter('wp_phpmailer_drivers', function (array $drivers): array {\n    $drivers['my-custom-driver'] = MyCustomDriver::class;\n\n    return $drivers;\n});\n ```\n\n### `wp_phpmailer_config_mappings`\n\n`$mappings = (array) apply_filters('wp_phpmailer_config_mappings', array $mapings)`\n\nFilters the whitelisted PHPMailer configuration (property names) array.\n'fromAddress', 'fromName', 'fromAuto' are special. Do not add them in mappings!\n\nParameters:\n\n- $mapings\n  * (_array_) the whitelisted PHPMailer configuration (property names)\n\nExample:\n\n```php\nadd_filter('wp_phpmailer_config_mappings', function (array $mappings): array {\n    $mappings['xxx'] = 'yyy';\n\n    return $mappings;\n});\n\n// The above filter results in:\nadd_action( 'phpmailer_init', function (PHPMailer $phpmailer) {\n    // $this-\u003econfig comes from `DriverInterface::makeConfig`.\n    $phpmailer-\u003exxx = $this-\u003econfig-\u003eget('yyy');\n});\n```\n\n## Minimum Requirements\n\n- PHP v7.2\n- WordPress v5.5\n\n## Installation\n\n### Composer (Recommended)\n\n```bash\ncomposer require itinerisltd/wp-phpmailer\n```\n\n### wordpress.org (WP CLI)\n\n```bash\nwp plugin install wp-phpmailer\n```\n\n### wordpress.org\n\nDownload from https://wordpress.org/plugins/wp-phpmailer\nThen, install `wp-phpmailer.zip` [as usual](https://codex.wordpress.org/Managing_Plugins#Installing_Plugins).\n\n### Build from Source (Not Recommended)\n\n```bash\n# Make sure you use the same PHP version as remote servers.\n# Building inside docker images is recommended.\nphp -v\n\n# Checkout source code\ngit clone https://github.com/ItinerisLtd/wp-phpmailer.git\ncd wp-phpmailer\ngit checkout \u003cthe-tag-or-the-branch-or-the-commit\u003e\n\n# Build the zip file\ncomposer release:build\n```\n\nThen, install `release/wp-phpmailer.zip` [as usual](https://codex.wordpress.org/Managing_Plugins#Installing_Plugins).\n\n## Common Errors\n\n### `NotFoundException` - `Driver 'xxx' not found, acceptable values are: aaa, bbb, ccc`\n\nReason: Driver is not found or not defined.\n\nTroubleshooting:\n\n- Ensure PHP constant is `WP_PHPMAILER_DRIVER` is correct\n- Ensure filter `wp_phpmailer_driver` is functioning correctly\n\n## FAQ\n\n### Where is the settings page?\n\nThere is no settings page.\n\nAll configurations are done by [PHP constants](https://www.php.net/manual/en/language.constants.php) and [WordPress filters](#filters).\n\n### Will you add a settings page?\n\nNo.\n\nWe have seen [countless](https://blog.sucuri.net/2019/03/0day-vulnerability-in-easy-wp-smtp-affects-thousands-of-sites.html) [vulnerabilities](https://www.pluginvulnerabilities.com/2016/04/04/when-full-disclosure-of-a-claimed-wordpress-plugin-vulnerability-leads-to-a-bigger-problem/) [related](https://www.wordfence.com/blog/2019/03/recent-social-warfare-vulnerability-allowed-remote-code-execution/) [to](https://www.wordfence.com/blog/2018/11/privilege-escalation-flaw-in-wp-gdpr-compliance-plugin-exploited-in-the-wild/) user inputs.\nMail settings don't change often and should be configured by a developer.\nTherefore, [WP PHPMailer](https://github.com/ItinerisLtd/wp-phpmailer) decided to use PHP constants instead of storing options in WordPress database.\n\nHowever, if you must, you can use [filters](#filters) to override this behavior.\n\n### What PHPMailer version bundled?\n\nThis plugin reuse [the PHPMailer class bundled with WordPress core](https://core.trac.wordpress.org/browser/trunk/src/wp-includes/class-phpmailer.php).\n\nThus, you have to keep WordPress core up to date to receive security patches.\n\n### Is it a must to use SMTP?\n\nNo.\n\nWhile you can make your own non-SMTP drivers, all default drivers are using SMTP. Pull requests are welcomed.\n\n### Will you add support for older PHP versions?\n\nNever! This plugin will only work on [actively supported PHP versions](https://secure.php.net/supported-versions.php).\n\nDon't use it on **end of life** or **security fixes only** PHP versions.\n\n### It looks awesome. Where can I find more goodies like this?\n\n- Articles on [Itineris' blog](https://www.itineris.co.uk/blog/)\n- More projects on [Itineris' GitHub profile](https://github.com/itinerisltd)\n- More plugins on [Itineris](https://profiles.wordpress.org/itinerisltd/#content-plugins) and [TangRufus](https://profiles.wordpress.org/tangrufus/#content-plugins) wp.org profiles\n- Follow [@itineris_ltd](https://twitter.com/itineris_ltd) and [@TangRufus](https://twitter.com/tangrufus) on Twitter\n- Hire [Itineris](https://www.itineris.co.uk/services/) to build your next awesome site\n\n### Where can I give :star::star::star::star::star: reviews?\n\nThanks! Glad you like it. It's important to let my boss knows somebody is using this project. Please consider:\n\n- leave a 5-star review on [wordpress.org](https://wordpress.org/support/plugin/wp-phpmailer/reviews/)\n- tweet something good with mentioning [@itineris_ltd](https://twitter.com/itineris_ltd) and [@TangRufus](https://twitter.com/tangrufus)\n- :star: star this [Github repo](https://github.com/ItinerisLtd/wp-phpmailer)\n- :eyes: watch this [Github repo](https://github.com/ItinerisLtd/wp-phpmailer)\n- write blog posts\n- submit [pull requests](https://github.com/ItinerisLtd/wp-phpmailer)\n- [hire Itineris](https://www.itineris.co.uk/services/)\n\n## Testing\n\n```sh-session\ncomposer test\ncomposer phpstan:analyse\ncomposer style:check\n```\n\nPull requests without tests will not be accepted!\n\n## Feedback\n\n**Please provide feedback!** We want to make this library useful in as many projects as possible.\nPlease submit an [issue](https://github.com/ItinerisLtd/wp-phpmailer/issues/new) and point out what you do and don't like, or fork the project and make suggestions.\n**No issue is too small.**\n\n## Security\n\nIf you discover any security related issues, please email [dev@itineris.co.uk](mailto:dev@itineris.co.uk) instead of using the issue tracker.\n\n## Credits\n\n[WP PHPMailer](https://github.com/ItinerisLtd/wp-phpmailer) is a [Itineris Limited](https://www.itineris.co.uk/) project created by [Tang Rufus](https://typist.tech).\n\nSpecial thanks to [Brandon](https://log1x.com/) whose [WP SMTP](https://github.com/Log1x/wp-smtp) inspired this project.\n\nFull list of contributors can be found [here](https://github.com/ItinerisLtd/wp-phpmailer/graphs/contributors).\n\n## License\n\n[WP PHPMailer](https://github.com/ItinerisLtd/wp-phpmailer) is released under the [MIT License](https://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitinerisltd%2Fwp-phpmailer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fitinerisltd%2Fwp-phpmailer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitinerisltd%2Fwp-phpmailer/lists"}