Sending WordPress Emails Using SMTP

Sending WordPress emails using SMTP is pretty straight forward so rather than using a plugin we can insert a small snippet to do the same thing.  All you need for sending WordPress emails via SMTP are your mail server credentials such as username, password and server address.

The WordPress email function wp_mail is essentially a wrapper for phpmailer which is a popular email class for PHP.  WordPress has an action hook called phpmailer_init which allows us to establish the phpmailer instance using SMTP.

Here is a code snippet to configure WordPress to sent SMTP emails.

 

Leave a Reply

Your email address will not be published. Required fields are marked *