php mail function not working ?

wp_mail not working ?

Here’s the best alternative solution.

Most of the time for noobs or beginners its diffucult to setup wordpress smtp mail server only with php. But, there’s always a way, right ? Using WP mail SMTP plugin makes it easy & very simple way to set that up & save your precious time. Rather its’ the easiest way one could setup email function on wordpress.

There are lot of people trying to configure mail function with php, wp_mail. Busy Googling Php mail function not working, wp_mail not working.This tutorial is for those people who still Googls the same to look for a sollution. This is not an exact sollution to that, But it is confirmed that your purpose will be served 100%. This is the best alternative sollution available.

WordPress has multiple ways one can set up email function. Best & easiest way could be using WP_MAIL plugin & you get 5 optional ways to setup the mail function.

  • Default PHP (none)
  • Gmail
  • MailGun
  • Sendgrid
  • Other SMTP

Here, we’re gonna discuss on How you could set it up with “Gmail” & “Other SMTP” option

Google SMTP Settings

Is your Gmail SMTP not working ? Wel, here’s sollution to your problem. It only takes 10-15 minutes to set up Gmail SMTP with your WordPress website. Look no further, follow these simple steps to set it up.

4 Easy steps to confugure Google mail API with WordPress

1. Install the Wp_Mail_SMTP Plugin from here 
2. Setup Google application
3. Copy the Keys; ClientID & Client Secret
4. Authorise WP Mail SMTP to send mails using Google account
Voila ! Now you start getting mails 🙂

STEP ONE: Install the plugin.

Go ahead & install the plugin from here

STEP TWO: Setup Google appliction

i. Login to the Gmail ID you want to use for this purpose

ii. Register your application for Gmail API Console from here

iii. Select “Create a project” and click continue as shown below

iv. In the next window click on Go to credentials.

Here, we’re gonna add credentials that we need, to the project

* Which API are we gonna use?
Gmail API
* Where will we be calling the API from?
Gmail API
* What data will we be accessing?
User data

v. Add those mentioned credentials above & as shown in the picture below

vi. Now, click on what credentials do I need?

vi. Go back to your WordPress WP_MAIL_SMTP window & copy the Authorised redirect URl and paste it back in the third row under “Authorised redirect URls”.

And, paste it back

Don’t forget to hit enter after you have pasted the Authorized URI

vii. Click on Create OAuth client ID

STEP THREE: Secret Key, ID & Authorization

i. Click on the edit button shown below

ii. Copy Client ID & Client secret and paste it in your WordPress Plugin backend where it’s asking for the same.

iii. Paste the ID & key as shown below & save

We’re almost done configuring the Web Application.

iv. Click on “Allow plugin to send emails using Google account” button, it takes you to login to your same Google account & to authorise finally.

Go ahead & Allow the app from your Google A/C.

Congratulations !! You’ve successfully set up email function on WordPress.

Time to test if the mail function is working:

On your wordpress dashboard Go to Settings>WP Mail SMTP>Email Test> Send an email to your email.

If you have followed all the steps properly then you should be able sending mails from your WordPress site.

 [ If you get URL 404 error then you should check STEP TWO>vi ] 

Send WordPress Emails Using Other SMTP

This way is the easiest you can setup email function, hardly it takes around 5 minutes.

Here you already have a third party email service provide. You need to know their SMTP Server & Port.

First of all you must know the email service provider that you are using.


i. Log in to your cPanel & head over to Email section & Click on Email Accounts

ii. Click on Access Webmail on any of you mail account

iii. Look foe Mail Client Mannual Setting

Copy all these from cPanel & paste it on WordPress

  1. SMTP Host
  2. Port
  3. Encryption type
  4. SMTP username ( your full mail address )
  5. Your mail id password

iv. Click on save settings

v. Now head over to public_html/wp-config.php & paste the code mentioned below

define( 'WPMS_ON', true );+
define( 'WPMS_SMTP_PASS', 'your_password' );

SUCCESS ! Your email function is configured successfully. 

If you are using some other email service provider then Just Google down ” SMTP server” along with their name & you should get it.

It’s very important keeping yourself updated with what’s happening on your website. Be it regarding any update, any event related notification, new user registration or Emails through Contact forms.

If you’re an active web developer then you know how important is this.

0 / 5 Reviews: 0


Previous articleThe Dark Side of Internet Technology | Educate Yourself Before it’s too Late
Next articleThe Who, What, Why & How of Virtual Private Server (VPS)
Technology is one of my greatest crush and has always been. Blogging is my hobby with the aim to share knowledge on technology. How things are done & works.


Please enter your comment!
Please enter your name here