Mail configuration / Adapters
See original GitHub issueWe 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!
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (4 by maintainers)
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 🎉
Some of this is related to #49 as well.