Last active
September 24, 2020 03:23
-
-
Save mrcave/5c56c803eaeafe01261eeded4b9c2067 to your computer and use it in GitHub Desktop.
WordPress multisite PHP mailer override for use with transactional email service
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 | |
//this file goes in /wp-content/mu-plugins | |
//https://gist.github.com/butlerblog/c5c5eae5ace5bdaefb5d | |
//constant configs in wp-config.php | |
add_action( 'phpmailer_init', 'use_smtp_email' ); | |
function use_smtp_email( $phpmailer ) { | |
$phpmailer->isSMTP(); | |
//https://deluxeblogtips.com/send-html-emails-in-wordpress/ | |
$phpmailer->IsHTML( true ); | |
$phpmailer->Host = SMTP_HOST; | |
$phpmailer->SMTPAuth = SMTP_AUTH; | |
$phpmailer->Port = SMTP_PORT; | |
$phpmailer->Username = SMTP_USER; | |
$phpmailer->Password = SMTP_PASS; | |
$phpmailer->SMTPSecure = SMTP_SECURE; | |
$phpmailer->From = SMTP_FROM; | |
$phpmailer->FromName = SMTP_NAME; | |
} |
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 | |
//this gets added to wp-config.php | |
define( "SMTP_USER", "user-id-here" ); | |
define( "SMTP_PASS", "user-pass-here" ); | |
define( "SMTP_HOST", "smtp.postmarkapp.com" ); | |
define( "SMTP_FROM", "[email protected]" ); | |
define( "SMTP_NAME", "Network Name" ); | |
define( "SMTP_PORT", "587" ); | |
define( "SMTP_SECURE", "tls" ); | |
define( "SMTP_AUTH", true ); | |
define( "SMTP_DEBUG", 0 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment