Project Blog SMTP Setup
In the last class, we set up a Ghost instance on Digital Ocean for this blog.
However, the default configuration lacked a working SMTP setup, and as such, the email invites I sent to the other team leads wouldn't go through. I solved this by following this other blog post, in which the author details how to use Gmail's own SMTP service.
A summary of the steps I took are as follows:
- I created gunn.alumni@gmail.com as a new Google account for the project. In order to enable the SMTP service, I was unfortunately forced to use my phone number for both the recovery and 2fa numbers (so please remind me to transfer the credentials and phone number to someone else at the end of the year).
- I navigated to https://myaccount.google.com/apppasswords and generated a new app password for a mail service.
3. I ssh'd into the machine and navigated to the folder containing our ghost instance:
ethan@fedora ~ ➜ ssh root@blog.gunnhigh.school
# switch to the ghost-mgr user
root@ghostonubuntu2204-s-4vcpu-8gb-sfo3-01:~# sudo -i -u ghost-mgr
# view running ghost processes
ghost-mgr@ghostonubuntu2204-s-4vcpu-8gb-sfo3-01:~$ ghost ls
# navigate to the location in the output table
ghost-mgr@ghostonubuntu2204-s-4vcpu-8gb-sfo3-01:~$ cd /var/www/ghost/
# open the config file in the text editor of your choice (I chose vim)
ghost-mgr@ghostonubuntu2204-s-4vcpu-8gb-sfo3-01:/var/www/ghost$ vim config.production.json
4. Add the following to the config file under "mail"
"mail": {
"transport": "SMTP",
"options": {
"service": "Google",
"host": "smtp.gmail.com",
"port": 587,
"auth": {
"user": "gunn.alumni@gmail.com",
"pass": "the password you generated earlier"
}
}
},
5. Restart the ghost instance
ghost-mgr@ghostonubuntu2204-s-4vcpu-8gb-sfo3-01:/var/www/ghost$ ghost restart
And now we're done! You can now go to the Ghost dashboard and invite new contributors via email.
For everyone else working on this project, I've sent invites for administrator accounts to all the team leads, so contact them if you want to add to the blog.