Error-Free Setup of Gmail SMTP for WordPress Emails: A Step-by-Step Guide


Yes, it is possible to configure Gmail SMTP via wp-config so that all emails sent from your website go through Gmail. Here are the steps:

  1. Log in to your Gmail account and navigate to the “Less secure apps” settings page.
  2. Turn on the “Allow less secure apps” option.
  3. Generate an App password for your WordPress website by following the instructions on this page:
  4. Open your wp-config.php file and add the following lines:
define( 'WP_MAIL_SMTP_AUTH', true );
define( 'WP_MAIL_SMTP_SECURE', 'tls' );
define( 'WP_MAIL_SMTP_PORT', 587 );
define( 'WP_MAIL_SMTP_HOST', '' );
define( 'WP_MAIL_SMTP_USERNAME', '' );
define( 'WP_MAIL_SMTP_PASSWORD', 'your-gmail-app-password' );

Replace “your-gmail-address” with your actual Gmail address and “your-gmail-app-password” with the app password you generated in step 3.

Save the changes to your wp-config.php file.

After completing these steps, all emails sent from your WordPress website will be sent through Gmail SMTP.

All Done!


Please enter your comment!
Please enter your name here