How to setup Ghost to send email using Gmail?

Currently, Ghost uses email only for resetting your password. Newer versions of Ghost and its plugins might provide more features which will require your Ghost blog to be configured to send emails. For example, some of these features might include newsletters or email subscriptions, email contact for users, email notifications for some events, etc.

For sending emails, Ghost uses Nodemailer. Nodemailer is a Node.js module which makes it very easy to send emails from a Node.js application. It lets you use popular email services with SMTP support such as Gmail, Yahoo, Hotmail, SES, Mailgun, iCloud, Yandex, Mail.Ru, etc.

In this guide, we will show you how to use Gmail to send emails from Ghost. You will need a Gmail account to follow, so create one if you don't already have a Gmail account.

 

Open the file config.js in a text editor

The file config.js is located in the root directory of your Ghost installation. Open this file in your favourite JavaScript editor or any plain text editor like Notepad.

The config.js file in the root directory of Ghost

 

Add Gmail SMTP settings

In the next step, you will need to add the following settings to the file config.js. Change the values for user: and pass: to match yours. In the file, you can add these settings in two places depending on whether you are running Ghost in development environment or in production environment.

mail: {
           transport: 'SMTP',
           options: {
              service: 'Gmail',
              auth: {
                  user: 'your.gmail.id@gmail.com',
                  pass: 'your-gmail-password'
             }
           }
        }

 

The first image shows the settings applied for Ghost blog in development mode, and the second image shows the Gmail SMTP settings for Ghost in production mode.

For development mode

Gmail SMTP settings for development mode in Ghost

 

For production mode

Gmail SMTP settings for production mode in Ghost

 

After you have updated the config.js file, save it.

For checking whether the email settings are working or not, restart Ghost, and use the Ghost's password reset form to send yourself a password reset link. Before doing so, make sure that you have set a valid Email address in the Ghost User settings page at /ghost/settings/user/.

You can access the password reset form at /ghost/forgotten, or by clicking on the Forgotten password? link on the log in page. Enter your email address and click on the SEND NEW PASSWORD button.

Log in page

Forgotten password link in the Ghost's log in page

Send new password page in Ghost

Ghost password reset form

If the email settings are working correctly, you should get a reset password email.

 

Related:

How to Backup Ghost Blog?

Ghost: How to add Images in Blog Posts?

How to Install Ghost on Windows 7 or Windows 8?

How to Embed YouTube video in Ghost Blog?

Note: This banner is an affiliate link. If you click on the banner and make a hosting purchase, we will get a small sum of money as referral fees from hostinger.com at no additional cost to you. This means, you pay only for the hosting purchase, and you don't have to pay any extra money for our fees.

Latest Videos