Mailhog
Like I said before, I moved my entire pet project to my local machine and exposed it to the net using Cloudflare Tunnel. One of them is a blog running on Ghost. When I tried to log in, I got an error. At first, I thought it was because I forgot the password, but it turned out that wasn’t the problem. The issue was Ghost trying to send the magic link/confirmation link and expecting me to click it and then log in with the security code.
It’s clear I don’t use SMTP for my Ghost setup because it’s just a hobby blog — I don’t need full-fledged features. As long as I can log in and write, that’s enough for me. But still, I couldn’t log in because Ghost couldn’t send the link to me, and I didn’t want to set up SMTP for now. Luckily, we have MailHog.
I set up MailHog in my Docker Compose:
mailhog:
image: mailhog/mailhog
restart: unless-stopped
ports:
- "8025:8025" # Mailhog web UI
- "1025:1025" # SMTP server Ghost uses
Then I updated the Ghost setup in my Docker Compose:
# Fake SMTP via Mailhog
mail__transport: SMTP
mail__options__host: mailhog
mail__options__port: 1025
Rebuilt and restarted the Docker, and done.
When I tried logging in, Ghost successfully sent the email. I opened the MailHog interface on my local machine, clicked the link, got the security code, sent it back to Ghost, and finally logged into my blog.