Configure self hosted Ghost blog to use your personal email

Enabling emails on your self-hosted Ghost blog opens up your opportunity to get email notifications on new subscribers, comments and other updates on your blog.
I guess you have set up your Ghost blog and are now stuck with the idea - How do I configure my self-hosted Ghost blog to send emails using my personal Gmail or any other email provider?
Official managed Ghost instance has all the bits pre-configured for us and we just need to pay the subscription fee. But on a self-hosted Ghost instance, we need to do some configurations on our own like sending emails.
Prerequisites
- SSH access to the Linux server where your Ghost blog is running
Configure your Ghost setup to trigger emails using the below steps:
If your Ghost blog is running over Docker (like the one in this article) then start with getting access to the shell in the container:
docker exec -it <container name/id> /bin/bash
Depending upon how you configured your Docker installation, you might need to prefix the above with sudo
. If you don't want to use sudo
then you must check out this article on how to run Docker commands without the sudo prefix.
Now navigate to the ghost installation directory and verify the config file:
ls
cat config.production.json
If you are using Docker like me, the default Ghost image does not have a text editor. Install Vim or any other editor of your liking using apt:
apt-get update
apt-get install vim
Open the production config file for the Ghost blog in edit mode using:
vi config.production.json
Find the mail object in the JSON file and update it to use your email's SMTP settings. I am using Zoho, you can freely use your Gmail - just copy the right settings from your email provider:
"mail": {
"transport": "SMTP",
"options": {
"service": "Zoho",
"host": "smtppro.zoho.in",
"port": 465,
"secure": true,
"auth": {
"user": "your_email",
"pass": "your_password"
}
}
}
One best practice would be to not use your email account password but generate app specific password if supported by your email provider.
Restart your ghost instance with ghost restart
or if using docker then restart your container docker restart <container name/id>
. Then verify if able to receive email by subscribing to your blog.
Issues that I faced:
-
Ghost by default expects two email addresses:
noreply@domain.com
andghost@domain.com
to send email notifications on new subscriptions/comments. I could see errors regarding them in logs and they were gone when I created the above aliases for the primary email in the config JSON above. -
I could not get the TLS port 587 to work and had some certificate errors in the console. So decided to use SSL on port 465.