SMTP

Send emails from local WordPress setup using SMTP

While doing testing of WordPress in local system many times we need to do the email testing and we can't do it as we don't have SMTP server installed on local system. Without going to option of installing SMTP server on local it would be easier to use free SMTP server to send emails from local WordPress setup. I have already given instructions on how to send emails using SMTP server from localhost which uses phpMailer script. WordPress also uses phpMailer to send emails so we can do the changes in coding files to use SMTP and provide username and password. But that is not a recommended option. We can do it easily using WP Mail SMTP plugin.

PHP – Send mail from localhost using SMTP

When you setup apache in local system it won't by default setup SMTP server. Hence, if you want to send emails from local system, you will have to either set up SMTP server on your local or use external SMTP server. There are many service providers available who can give you SMTP, username and password to send email using their SMTP server. But it isn't very easy and straight forward to use SMTP in PHP. While searching I found PHPMailer script doing that very nicely and efficiently. You can download PHPMailer from their official site and read further to get more instructions on how to use gmail (or any other) SMTP.