question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Update Nodemailer and allow non-SMTP mail config

See original GitHub issue

Would 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 in core/server/mail as nested dependencies).
  • Rewrite GhostMailer.js for smoothly utilizing new Nodemailer’s API without breaking changes to mail 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:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

3reactions
ErisDScommented, Oct 19, 2017

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:

  • Refactor mail so that it can be extended with adapters
  • Use the oldschool nodemailer as the default adapter, ensure there are no backwards incompatible changes
  • Ensure it’s possible to build a custom mail adapter and document it

Then:

  • Get Ghost-CLI upgraded to support adapter installs

Finally, in Ghost 2.0

  • Change the default adapter / move towards there being no default, and Ghost-CLI handles installing and configuring mail.
0reactions
kaizenseedcommented, Aug 4, 2020

Hi

Is there any info on if the nodemailer package will be updated to latest versions?

Thanks

Read more comments on GitHub >

github_iconTop Results From Across the Web

Nodemailer :: Nodemailer
Nodemailer is a module for Node.js to send emails. ... a self-hosted email gateway that allows making REST requests against IMAP and SMTP...
Read more >
SMTP Server - Nodemailer
_smtp-server_ allows you to listen on ports 25/24/465/587 etc. using SMTP or ... If the server doesn't start in TLS mode, it is...
Read more >
Message configuration - Nodemailer
Message configuration. The following are the possible fields of an email message: Common fields. from - The email address of the sender.
Read more >
SMTP transport - Nodemailer
SMTP is the main transport in Nodemailer for delivering messages. ... Most SMTP servers allow connection upgrade via STARTTLS command but to use...
Read more >
Setup SMTP - Nodemailer
All SMTP connections allow to use proxies for making connections. ... TLS will not be used (either to connect, or as a STARTTLS...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found