Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mail configuration / Adapters #232

Closed
ErisDS opened this issue Jun 26, 2017 · 6 comments
Closed

Mail configuration / Adapters #232

ErisDS opened this issue Jun 26, 2017 · 6 comments

Comments

@ErisDS
Copy link
Member

ErisDS commented Jun 26, 2017

We haven't yet got a plan for handling mail config with Ghost-CLI.

Short term, this will need to be a configuration task. It may also be worth adding a line at the end of ghost install telling users to read a page on configuration, which covers the stuff ghost-cli doesn't do yet, like nginx client_max_body_size and mail.


Whilst we're here, I thought I'd write down my long term idea somewhere to percolate on:

Long term, my original thought was that we would upgrade nodemailer to the new version where different kinds of mail handling are separate, and that we would use our concept of adapters to make it possible to override the default mail adapter.

Alternatively we could do a similar thing, using adapters and then use modules like mailgun-js directly instead of going through nodemailer.

Install process

Either way, we'd need some concept in ghost-cli of being able to run a command to add an adapter. Adapters would be npm modules which follow some pattern or convention.

E.g.

ghost adapter type name or ghost adapter npm-module-name
ghost adapter mail smtp or ghost adapter ghost-mail-adapter-smtp

One idea would be to read the package.json file for the module, to verify the module is something that Ghost-CLI can understand. We already did this in the Casper package.json: https://github.com/TryGhost/Casper/blob/master/package.json#L19 with the gpm key.

Config

An adapter would probably need to provide it's own config requirements. E.g. mailgun-js needs a domain and api key whereas the nodemailer mailgun thing has a standard format that looks more similar to SMTP config. Perhaps this is speced in a special format, maybe in the package.json, etc, or maybe all Adapters expose a function for this.. many things are possible.

Enable/disable

It may be necessary to have a set of adapter commands rather than a single one:

ghost adapter install ghost-mail-adapter-smtp
ghost adapter enable ghost-mail-adapter-smtp
ghost adapter config ghost-mail-adapter-smtp
ghost adapter disable ghost-mail-adapter-smtp

This is just a brain dump for now!

@kirrg001
Copy link
Contributor

I have added the short term solution to #216 (be able to configure mail and show link to documentation after production installation), because this issue is mainly for post 1.0.0. I am collection all small tasks in #216 at the moment and reorganise/structure the issue later in the evening.

@acburdine
Copy link
Member

Some of this is related to #49 as well.

@ErisDS
Copy link
Member Author

ErisDS commented Jun 26, 2017

Yar, I mainly wrote it because I totally forgot that ghost-cli doesn't do any mail config. Short term anything goes, long term mail should probably be adapters, which needs work in Ghost as well.

Have done 4 successful beta.1 -> beta.2 updates btw 🎉

@kirrg001 kirrg001 changed the title Mail configuration Mail configuration / Adapters Jun 26, 2017
@ErisDS ErisDS added the rogue label Jun 27, 2017
@ErisDS
Copy link
Member Author

ErisDS commented Jun 27, 2017

Waiting on the short term version of this, currently in #216, where I am able to do the mail config with ghost-config.

Prolly my no.1 blocker right now, soz @cobbspur 😁

ErisDS added a commit to ErisDS/Ghost-CLI that referenced this issue Jun 27, 2017
refs TryGhost#232, TryGhost#216

- this is the most straight forward pass through adding mail config options
- there is loads of small tweaks possible here, but they are not required
E.g.
- auto-set transport to smtp if any other argument is supplied
- use grouping to make the output better
- stronger use of implies?
ErisDS added a commit to ErisDS/Ghost-CLI that referenced this issue Jun 27, 2017
refs TryGhost#232, TryGhost#216

- this is the most straight forward pass through adding mail config options
- there is loads of small tweaks possible here, but they are not required
E.g.
- auto-set transport to smtp if any other argument is supplied
- use grouping to make the output better
- stronger use of implies?
acburdine pushed a commit that referenced this issue Jun 27, 2017
refs #232, #216

- this is the most straight forward pass through adding mail config options
- there is loads of small tweaks possible here, but they are not required
E.g.
- auto-set transport to smtp if any other argument is supplied
- use grouping to make the output better
- stronger use of implies?
@kirrg001 kirrg001 added the later label Jan 12, 2018
@kirrg001 kirrg001 removed the rogue label Jan 3, 2019
@ayewo
Copy link

ayewo commented Jan 4, 2021

Hi @ErisDS

I landed on this issue from #8933.
Are there any near-term plans to fix this issue? I'd like to use a newer version of NodeMailer, but do not want to lose the ability to seamlessly upgrade Ghost to a newer version.

Background

When I enabled the newsletter feature in my instance of Ghost (v3.38.3), I noticed that all confirmation emails were ending up in the spam folder for Gmail accounts. I checked the docs for email config and it turns out Ghost is using the "direct mail service". To avoid the issue, I decided it would be better to switch to using a dedicated Gmail/G Suite account for all outbound emails from Ghost.

I did some research and settled on creating a G Suite email address with 2LO authentication (2-legged OAuth2) enabled. Now, my challenge is that the NodeMailer shipped with Ghost bundles NodeMailer v0.7.1, which is from 7 years ago ...

Suggestion

Perhaps we could take a step back and come up with a design that allows us to eat our cake and have it too? I think we could arrive at a design that allows old instances of Ghost to continue with the old version of NodeMailer, while newer instances could check for the presence of a flag to use newer versions of NodeMailer. What do you think?

@github-actions
Copy link

github-actions bot commented May 5, 2021

Our bot has automatically marked this issue as stale because there has not been any activity here in some time. The issue will be closed soon if there are no further updates, however we ask that you do not post comments to keep the issue open if you are not actively working on a PR. We keep the issue list minimal so we can keep focus on the most pressing issues. Closed issues can always be reopened if a new contributor is found. Thank you for understanding 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants