WordPress itself does not provides SMTP settings to configure in the admin area.
But there are two ways that you can send mail from WordPress:
- By using plugins that set up SMTP connections to outside mail servers.
- Or by using WordPress’ internal
wp_mail()function, which defaults to using PHP’s
mail()function, fully relying on PHP’s settings to handle mail.
To send mail via
wp_mail(), WordPress uses an internal PHPMailer class which sets some default values.
The included PHPMailer class defaults to using PHP’s mail() function, but can also instead connect to your mail account (e.g., gmail) directly.
To use the mail() function, you’ll need to enable and configure MSMTP to establish a local SMTP proxy/forwarding to a real mail server or mail account (such as gmail).
Then edit file –
public $From = 'root@localhost'; public $Host = 'localhost'; public $SMTPAutoTLS = true;
public $From = 'email@example.com'; public $Host = '127.0.0.1'; public $SMTPAutoTLS = false;
The above settings is for a local SMTP proxy such as MSMTP or for a local SMTP server.
If you want to connect to gmail directly, change “$Mailer” to “SMTP” and update settings accordingly.
Debugging SMTP Issues
Check the website’s HTTP and PHP error log files, and the general PHP error log file for logged PHP errors.
Check PHP’s mail() function log and MSMTP’s log file to make sure that email is not being rejected because the header/from is invalid.
PHP mail log – C:\WampDeveloper\Logs\Php\maillog.txt
MSMTP mail log – C:\WampDeveloper\Tools\msmtp\msmtplog.txt