Mail sending via SMTP for WordPress

I was looking for some really simple SMTP solution for WordPress, only some code to send emails via SMTP. Without a plugin for localhost usage.

Came up with the following script in wp-content/mu-plugins/smtp.php

add_action('phpmailer_init', 'custom_phpmailer_init');
function custom_phpmailer_init($phpmailer) {  
 $phpmailer->Host = '';
 $phpmailer->SMTPDebug = 0;
 $phpmailer->SMTPAuth = true;
 $phpmailer->SMTPSecure = "ssl";
 $phpmailer->Port = 465;
 $phpmailer->Username = '';
 $phpmailer->Password = '';

return $phpmailer;

Author: Michal Zuber

Full stack developer, biker and rollerblader. Owner and developer at Co-founded Blog at

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s