mizner
3/20/2016 - 1:07 AM

WordPress SMTP AWS Setup

WordPress SMTP AWS 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;
    
} );