Skip to content

Instantly share code, notes, and snippets.

@Veraxus
Last active May 22, 2018 02:33
Show Gist options
  • Save Veraxus/238f3d1593c7bf93b6d6 to your computer and use it in GitHub Desktop.
Save Veraxus/238f3d1593c7bf93b6d6 to your computer and use it in GitHub Desktop.
WordPress SMTP AWS SES Setup
<?php
/*
Plugin Name: SMTP Configuration
Plugin URI:
Description: Force WordPress to use SMTP settings for AWS SES.
Version: 1.0
Author: Matt van Andel
Author URI: http://mattvanandel.com
License: GPLv2 or later
*/
add_action( 'phpmailer_init', function ( PHPMailer $phpmailer ) {
$phpmailer->IsSMTP();
$phpmailer->SMTPAuth = true; // ses requires authentication
$phpmailer->SMTPSecure = 'tls'; // ses requires tls
$phpmailer->Port = 587; // ses requires port 587
$phpmailer->Host = 'ses endpoint'; // set to your ses endpoint
$phpmailer->Username = 'ses username'; // set to username generated by ses smtp credentials
$phpmailer->Password = 'ses password'; // set to password generated by ses smtp credentials
//$phpmailer->SMTPDebug = 2;
//$phpmailer->debug = 1;
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment