Skip to content

Instantly share code, notes, and snippets.

@ovizii
Created April 19, 2014 09:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ovizii/11079259 to your computer and use it in GitHub Desktop.
Save ovizii/11079259 to your computer and use it in GitHub Desktop.
Send mails through SMTP without plugin
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