How I Integrated Ghost’s Newsletter with Oracle Cloud Infrastructure (OCI) for Free
Hello there! I'm back with another guide. This time, I’ll walk you through how I integrated Ghost’s newsletter feature with Oracle Cloud Infrastructure (OCI)—without paying a anything!
I was previously using WordPress for my personal blog, but it felt a little too mainstream. There were just too many plugins and features I didn’t need. Then I discovered Ghost, and I loved how minimalist and straightforward it was. Everything just works, without much tweaking. However, I overlooked one crucial feature: newsletters.
Ghost offers a built-in subscribe button, but I realized mine wasn’t working, because I hadn’t configured it properly. Setting up the Ghost blog itself was a breeze, but getting the newsletter feature to work wasn’t as simple—especially if you don’t want to pay for services like Mailgun.
The Mailgun Problem
Ghost uses Mailgun for sending bulk emails to subscribers. Unfortunately, Mailgun is now a paid service for bulk email, and Ghost highly recommends bulk mail solutions due to issues with spam control tools. Ghost even warns against using plain SMTP addresses for newsletters because you risk getting blacklisted by spam filters. You can check out their stance on it here.
But I thought, maybe the generous free tier of OCI could help me out here, and guess what? It did! OCI offers up to 3,000 emails per month for free as part of its always free resources. Sure, I could have gone with Amazon’s solution, but it is not entirely free. Free is better when it’s fully free, right?
After figuring that out, I dove deeper into the setup. Let me walk you through it!
- Setup OCI Email Delivery Domain
- Head over to the Email Delivery section in OCI.
- Create an Email Domain with your domain name.
- DKIM and DNS Settings
- Once your domain is set up, click on it, and you’ll see the DKIM settings.
- Add a DKIM by creating a name for it. Afterward, you'll see a CNAME record (something like
selector_name._domainkey.yourdomain.com
) along with a bulky Text Record Value. - You need to provide this information to your domain provider’s DNS settings (I’m using Cloudflare). Add a record with the name (without your domain name) and set the type to TXT. In the content section, paste the Text Record Value.
- SPF DNS Settings
- For additional security, it’s recommended to add SPF information. This helps email servers verify that OCI is allowed to send emails on your behalf.
- You can find the SPF info in Oracle's documentation. Just add it as another TXT record in your DNS provider’s settings, similar to the DKIM step.
- Add Approved Senders
- In the Email Delivery section, go to Approved Senders and add the email addresses you want to send from (e.g.,
[email protected]
).
- Generate SMTP Credentials
- Ghost requires SMTP credentials to send newsletters. You can generate these in your OCI account by going to your profile, scrolling to SMTP Credentials under the Resources section, and generating new credentials.
- Be sure to copy the username and password before closing the window, as you won’t be able to see them again!
- Configure Ghost to Use OCI Email Delivery
- Since I’m running Ghost using Docker Compose, I added the following environment variables to my Docker Compose file. These configure Ghost to use OCI’s SMTP server for sending newsletters:
mail__transport=SMTP
mail__options__host=ssmtp.email.your_region.oci.oraclecloud.com
mail__options__port=587
mail__options__auth__user=YOUR_SMTP_USERNAME
mail__options__auth__pass=YOUR_SMTP_PASSWORD
mail__from=Some Name <[email protected]>
- You can find these SMTP settings under the Email Delivery configuration in OCI.
- Complete the Setup in Ghost
- Finally, go into Ghost’s admin panel, navigate to Settings > Newsletters, and configure your newsletter with the sender email you added in the Approved Senders section of OCI.
Troubleshooting Issues I Faced
Even with the steps above, I hit a few snags along the way:
- Configuring HTTP instead of HTTPS: At first, I had mistakenly set Ghost to use HTTP but I was pointing HTTPS, which caused issues with the newsletter feature. Make sure you configure it properly with just one.
- SMTP vs. OCI Credentials: I initially thought OCI credentials would work as SMTP credentials, but they’re different. You need to generate separate SMTP credentials for email delivery.
- Email Formatting: Ghost requires the sender email to be formatted as
Name <[email protected]>
, which is slightly different from the usual format. Don’t overlook this!
Why This Matters
I couldn’t find any clear guides on how to set up Ghost newsletters without using a paid provider, and I know there are free alternatives, but they didn’t fit my needs. That’s why I decided to write this guide, to help others who want a reliable, cost-free solution.
By following these steps, you can leverage OCI’s always free tier to send newsletters without worrying about extra costs or the risk of getting blacklisted.
If you have any questions or need more details, feel free to reach out. Good luck, and happy blogging!