Last active
April 11, 2016 11:37
-
-
Save khlbrg/9741099 to your computer and use it in GitHub Desktop.
Easy way to be able to send mail with SMTP in Wordpress.
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
add_action('phpmailer_init','send_smtp_email'); | |
function send_smtp_email( $phpmailer ) | |
{ | |
// Define that we are sending with SMTP | |
$phpmailer->isSMTP(); | |
// The hostname of the mail server | |
$phpmailer->Host = "smtp.example.com"; | |
// Use SMTP authentication (true|false) | |
$phpmailer->SMTPAuth = true; | |
// SMTP port number - likely to be 25, 465 or 587 | |
$phpmailer->Port = "587"; | |
// Username to use for SMTP authentication | |
$phpmailer->Username = "yourusername"; | |
// Password to use for SMTP authentication | |
$phpmailer->Password = "yourpassword"; | |
// The encryption system to use - ssl (deprecated) or tls | |
$phpmailer->SMTPSecure = "tls"; | |
$phpmailer->From = "your-email-address"; | |
$phpmailer->FromName = "Your Name"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment