Skip to content

Instantly share code, notes, and snippets.

@damiencarbery
Last active December 6, 2021 10:38
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save damiencarbery/ab4a37f5892dec4a6bfc4c70adcb2d38 to your computer and use it in GitHub Desktop.
Save damiencarbery/ab4a37f5892dec4a6bfc4c70adcb2d38 to your computer and use it in GitHub Desktop.
Sent WordPress emails with SMTP - Deliver emails reliably by using SMTP. Use a tiny streamlined plugin to keep things fast. https://www.damiencarbery.com/2019/01/send-wordpress-emails-with-smtp/
<?php
/*
Plugin Name: Send email via SMTP
Plugin URI: https://www.damiencarbery.com/2019/01/send-wordpress-emails-with-smtp/
Description: Send emails via SMTP.
Author: Damien Carbery
Version: 0.1
*/
add_action( 'phpmailer_init', 'send_smtp_email' );
function send_smtp_email( $phpmailer ) {
$phpmailer->isSMTP();
$phpmailer->Host = 'smtp.yourhost.com';
$phpmailer->SMTPAuth = true;
$phpmailer->Port = 587;
$phpmailer->Username = 'me@mydomain.com';
$phpmailer->Password = 'ThisIsNotMyPassword';
$phpmailer->SMTPSecure = 'tls';
$phpmailer->From = 'me@mydomain.com';
$phpmailer->FromName = 'My Name';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment