Last active
September 12, 2023 19:17
-
-
Save onecooltaco/1c3e2d108fa2cd5c3d029987fa9b814c to your computer and use it in GitHub Desktop.
Reconfigure PHPMailer so that WordPress AWS SES to send mail via Amazon. Change Username, Password, and Host to match your AWS settings. Then add to `mu-plugins` to use.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/*** | |
Plugin Name: Amazon SES SMTP | |
Plugin URI: https://gist.github.com/onecooltaco/1c3e2d108fa2cd5c3d029987fa9b814c | |
Description: Send mail from Amazon SES | |
Version: 1.0.0 | |
Author: Jeremy Leggat | |
***/ | |
/* | |
This program is free software; you can redistribute it and/or modify | |
it under the terms of the GNU General Public License, version 2, as | |
published by the Free Software Foundation. | |
This program is distributed in the hope that it will be useful, | |
but WITHOUT ANY WARRANTY; without even the implied warranty of | |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
GNU General Public License for more details. | |
You should have received a copy of the GNU General Public License | |
along with this program; if not, write to the Free Software | |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
*/ | |
// Amazon SES SMTP to send PHP mail. | |
add_action( 'phpmailer_init', 'amazon_ses_smtp' ); | |
function amazon_ses_smtp( $phpmailer ) { | |
$phpmailer->isSMTP(); | |
$phpmailer->SMTPAuth = true; | |
$phpmailer->Username = '####################'; | |
$phpmailer->Password = '#################################'; | |
$phpmailer->Host = '{email-smtp.us-east-1.amazonaws.com'; | |
$phpmailer->Port = 587; | |
$phpmailer->SMTPSecure = 'tls'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment