Hi there, right upfront I have to say I like Ghost and I use the docker version of it. Lately though, with the move to push Mailgun as the sole provider for bulk emails, something under the hood has broken for basic emails.
With the latest iteration of the Docker image, a clean install does not allow me to send a simple email to add an additional staff member. This used to be possible right out of the box. Why is this no longer possible? Do I need to configure something? This is not about bulk email, this is simple one-off emails to staff. Does this then also require me to sign up to Mailgun?
Appreciate if someone can put me right here.
There are two kinds of email setup you need to run Ghost – independent on whether you’re self hosting on Docker or directly with the CLI.
One is for bulk emails – that’s where Mailgun comes in. For your use case you can ignore that.
The other one is for so-called transactional emails. For that you need to setup an SMTP connection.
To do this in a Docker environment, set these environment variables, replacing the values with your SMTP credentials, of course:
Restart your Docker container and you should then be able to invite staff members :)
If you don’t configure the SMTP settings then by default Ghost will attempt to use the local system which is entirely dependent on how the underlying host is set up. It’s not a reliable at all, most of the time there’s no local mail facility and when there is it’s very likely any emails will end up in spam if the underlying host isn’t set up to route through a larger mail provider.
Nothing has changed in Ghost in this regard so it sounds like you’ve just run into differences in hosting setup.
Configuring an SMTP account (Mailgun or otherwise) as outlined above is always recommended.
hmmm, I answered too soon. With the outstanding invitations I had I had 2 emails to send. After changing the settings as above and restarting the docker instance, the first staff email invitation went straight away. The next one didnt. I see in the error log the following: GhostMailer.handleDirectTransportResponse (/var/lib/ghost/versions/5.69.0/core/server/services/mail/GhostMailer.js:158:19)\n at GhostMailer.send (/var/lib/ghost/versions/5.69.0/core/server/services/mail/GhostMailer.js:120:25)\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)",“hideStack”:false},“msg”:“Error sending email: Failed to send email. Reason: Email has been temporarily rejected. Please check your email settings and resend the invitation.”,“time”:“2023-10-14T13:45:50.719Z”,“v”:0}
It appears there is a timer set between emails being sent? Would that be right? The same email went perfectly ok 5+ mins later.
So, I have just tried to replicate that, but wasn’t successful.
I have sent multiple emails within a few seconds to a) the same new staff member and b) to different new staff members.
Based on the implementation in the Ghost core, I can see that the error message
Email has been temporarily rejected is only thrown when the so-called “direct transport” is used.
I am not an expert in that particular area, but from what I pieced together, this is the “local system” @Kevin mentioned above (correct me if I am wrong here), meaning that the SMTP settings don’t seem to be applied. This then leads to the receiving SMTP server rejecting the message, because it probably violated a spam policy.
If the email went out a bit later without issues, I would try it with another one. See what happens. You could also try to reset your password for your Ghost user. The underlying email is sent with the same mail connection as staff invitations and should also have a high probability of being rejected, if the direct transport system is being used rather than the SMTP you set up.