PHPMail is the default function used by WordPress to send email e.g. to notify you of a new comment or to send you a message posted via a contact form. However, many hosting providers are now disabling the use of PHPMail on their shared hosting servers for security reasons – usually because loads of spam mail is being sent out from the server using spamming scripts with the help of the PHPMail function.
Instead, they may require you to use SMTP authentication to continue to allow WordPress to send out emails – and if you don’t change then WordPress email delivery will fail.
It is possible to force WordPress to use SMTP mail by editing core .php files but this is not easy and it would help if you had some coding knowledge – a much simpler method for most WordPress users is to add the WP Mail SMTP plugin.
How To Use WP Mail SMTP Plugin – Download the plugin from WordPress here and install it to your WordPress site as usual then activate the plugin. In the WordPress ‘Settings’ menu you should see a new option of ‘Email’ – click on this to enter the ‘Advanced Email Options’ window and configure as follows:
- In the top section, fill in the email address and name that you want emails to be sent from
- Ensure that ‘Send All Emails Via SMTP’ is selected – this is the most important step (it should already be selected by default)
- Tick the ‘Return Path’ box if you want the return path of emails sent from WordPress to match the email address you put in ‘From Mail’ above – in most cases you would want to do this
Now fill in the rest of the ‘SMTP Options’ below (these settings should work for most users – if you are unsure, confirm them with your hosting provider):
- Type in your SMTP host name (your domain mail server or SMTP server for external email account e.g. Gmail if you use it)
- Set the SMTP port to 465 (for secure SMTP)
- Set encryption to ‘Use SSL encryption’
- Set authentication to ‘Yes: Use SMTP authentication’
- Now type in your email username and password (same domain as your SMTP host name above e.g. this could be your domain email account or Gmail etc if you have external email).
- Click the Save Changes button
To send yourself a Test Email to check if it works just type in your own email address and click ‘Send Test’. If everything is working right you should get the message ‘Your message was sent successfully’ – you are now using SMTP authentication instead of PHPMail for your email in WordPress :-)
If it doesn’t work, double check all the settings. If you were using Gmail etc try changing the settings to use your own domain email account and server name then retest – if it still fails then contact your web hosting provider to confirm specific settings for your email system and use those.