Update Nodemailer and allow non-SMTP mail config
See original GitHub issueWould be great if Ghost could bump Nodemailer version from 0.7
, which is three years old, to 4.x
. This will have some good effects like possibility to use API endpoints instead of SMTP. See https://github.com/TryGhost/Ghost/issues/7930. The one reason why it can be handy is that our project team cannot use Mailgun’s SMTP workflow due to our client’s restrictions and we are using API key instead.
A bunch of similar issues were closed before (https://github.com/TryGhost/Ghost/issues/4125, https://github.com/TryGhost/Ghost/issues/4817) arguing that there should be a PR opened for this instead. Well, there is now (https://github.com/TryGhost/Ghost/pull/8930), though it’s pretty raw one, but nevertheless, it’s working for us (just for us, probably). There I was advised to open a PR (we’ve gone full circle now I suppose 😃 to discuss this further, so here we are.
So, summarizing all the steps required for this to work as I see it, we need to:
- Bump
nodemailer
package. - Add custom Nodemailer transports (e.g.
nodemailer-mailgun-transport
, possibly not in root folder but incore/server/mail
as nested dependencies). - Rewrite
GhostMailer.js
for smoothly utilizing new Nodemailer’s API without breaking changes tomail
config (in order to avoid major Ghost version bump). - Rewrite
GhostMailer_spec.js
tests. - Update documentation.
I think a somewhat good starting point could be my pull request here.
I’d be happy to hear from Ghost devs and community about it. Thanks.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:10 (6 by maintainers)
Top GitHub Comments
I apologise that this has appeared to go around in circles. The problem here, as explained by @kevinansfield is that we cannot update NodeMailer without breaking backwards compatability.
When we first pinned NodeMailer to 0.7, there was promise that that version would always be supported and so we had no need nor plan for how to upgrade. However, the situation has changed and Ghost has also evolved.
The plan we have for how to upgrade is to use adapters. This was mentioned in #7930, but there is some advanced write up on the Ghost-CLI repo in TryGhost/Ghost-CLI#232 and TryGhost/Ghost-CLI/#49.
The reason why this is discussed on the Ghost-CLI repo and not the Ghost repo, is that without having the infrastructure in the cli tool to easily install adapters, we can’t really move mail towards using them. The current adapters: scheduling & storage both have sensible defaults and so installing an adapter is a task for a developer who knows they want something custom. With mail, I think keeping the old nodemailer as a sensible default might work for Ghost 1.0. We’d probably switch to using Mailgun’s API as the default (we’re fairly biased towards Mailgun too 😉 ) and forcing everyone else to setup a new adapter.
So the way forward is this:
Then:
Finally, in Ghost 2.0
Hi
Is there any info on if the nodemailer package will be updated to latest versions?
Thanks