How To Fix Wordpress Not Sending Emails Without Plugin

If you want to know how to fix WordPress not sending emails issue without using any plugins this guide will show you exactly that.

How do you identify if WordPress email settings are wrong? 

  • Contact form 7 not sending email
  • WordPress not sending password reset email
  • WordPress admin email change not sending confirmation
  • GMail not receiving emails from WordPress
  • WordPress email sent but not received

WordPress SMTP settings issue

Out of the box WordPress does not have built in SMTP (Simple Mail Transport Protocol) settings and uses the PHP mail system insead. There are plugins on WordPress.org repository you can download and they might fix this problem, but in this tutorial we will do it manually without any plugins.

Fix Wordpress not sending emails without plugin

In order to change how WordPress handles email sending you have to have access to your server files. You can do it by directly connecting to your server by using Filezilla, WinSCP or another client of your choice. You can also do that via the web hosting control panel, most likely you have File manager build in.

Add email setting in wp-config.php

Once you are connected and have access to your WordPress files open wp-config.php add this php code. Change all credentials which you’re gonna use.ย 

// SMTP email settings
define( 'SMTP_USER', 'myemail@domain.com' );
define( 'SMTP_PASS', 'mypassword' );
define( 'SMTP_HOST', 'smtp.gmail.com' );
define( 'SMTP_FROM', 'myemail@domain.com' );
define( 'SMTP_NAME', 'John Smith' );
define( 'SMTP_PORT', '587' );
define( 'SMTP_SECURE', 'tls' );
define( 'SMTP_AUTH', true );

Save the file and close it. 

Add email setting in functions.php 

In order to add the following configuration setting I suggest you use the Child theme in WordPress. Go to your dashboard-> Appearance-> Theme File Editor and select functions.php file.

Copy and paste the code below.

// Send email via SMTP
add_action( 'phpmailer_init', 'my_phpmailer_example' );
function my_phpmailer_example( $phpmailer ) {
    $phpmailer->isSMTP();     
    $phpmailer->Host = SMTP_HOST;
    $phpmailer->SMTPAuth = SMTP_AUTH;
    $phpmailer->Port = SMTP_PORT;
    $phpmailer->Username = SMTP_USER;
    $phpmailer->Password = SMTP_PASS;
    $phpmailer->SMTPSecure = SMTP_SECURE;
    $phpmailer->From = SMTP_FROM;
    $phpmailer->FromName = SMTP_NAME;
}

This code overwrites default WordPress email settings configuration we defined in the config file earlier. So the next time plugins (like Contact form 7) will try to send email, your custom SMTP settings will be used rather than default ones.  

What are SMTP settings for WordPress?

I will list here the most common SMTP email sending providers in case you want to use them.

My hosting SMTP settings 

If you want to use your own email server, which is on your hosting same as your website, then most of the time these settings will work.

  • SMTP host: mail.mydomainname.com (replace mydomainname with yours).
  • For SMTP port 465 is most often used. 
  • Encryption SSL Port 443 or TLS Port 587
  • Sending limit: most likely not unless configures othervise ๐Ÿ™‚

Note: TLS (Transport Layer Security) is more secure updated version of SSL

Also check email DNS records for email deliverability if you’re using own hosted email server.

GMail SMTP settings

  • SMTP host: smtp.gmail.com
  • SSL port: 465
  • TLS port: 587
  • Use your email and password for authentication
  • Sending limit: 500 messages a day 

Outlook SMTP settings

  • SMTP host: smtp-mail.outlook.com
  • TLS port: 587
  • Without TLS/SSL: 25
  • sending limit: 300 messages a day

Yahoo SMTP settings

  • SMTP host: smtp.mail.yahoo.com
  • SSL port: 465
  • TLS port: 587
  • Sending limits: 500 messages a day

Wrapping up

Congrats you have manually changed some settings and hopefully the issue WordPress not sending emails is gone.

About Mantas J

Blogger, marketer, coffee lover,- currently now developing several online projects. I know a thing or two about digital marketing :) Follow me on Twitter or YouTube.