How to Setup Office 365 as the SMTP Mailer for Ghost
On a recent project of wizards, the client required Office 365 to be used as their SMTP mailer for their ghost instance. As we haven't used O365 as SMTP mailer in ghost. After a bit of trial, we have figured out how to use Office 365 as an SMTP mailer in ghost. & thought it would be worth sharing with our users if anyone trying to do so.
Checkout ๐ https://wizards.inoryum.com
Step 1
Get your SMTL credentials from your Office 365 account. ย For more info on how to get the credentials click here
Step 2
Login into your server
ssh user@yourserverip
Step 3
Edit the config.production.json
file. Make sure you know your ghost installation directory. Usually, the config resides in /var/www/ghost/
directory. Edit the file by running the following command
nano /var/www/ghost/config.production.json
Step 4
Replate following
"mail": {
"transport": "Direct"
},
with
"mail": {
"from": "[email protected]",
"transport": "SMTP",
"options": {
"host": "smtp.office365.com",
"port": 587,
"service": "O365",
"secure": false,
"requireTLS": true,
"auth": {
"user": "[email protected]",
"pass": "password"
}
}
},
replace the email & password you got from outlook & save the file.
Step 5
In order for your settings changes to take effect, restart the ghost instance using the following command
ghost restart
After the reboot, your ghost instance will be able to deliver the emails (transactional) using your Office365 SMTP credentials.
Hopefully, you find this helpful.