Interfacing Ghost with Emails: Sending out emails when new posts are published and creating new posts by sending emails.
Note Currently only one direction is implemented: By sending emails you can create blog posts.
Prerequisites:
- Node js installed
Get the code, install the dependencies and start it:
git clone https://github.com/tillg/mail2ghost2mail.git
cd mail2ghost2mail
npm i
npm start
Of course it will need some configuration 😀 ...see below...
mail2ghost2mail
has a couple of confguration areas and options:
In order to read/write emails and ghost posts it needs access to those 2 systems. This information is held in the .env
file. You can create and edit it like so:
cd src
cp sample.env .env
Then edit the file .env
and enter your configuration for accessing the email account as well as the Ghost API.
When creating a new blog post based on an incoming email we need to set the author. This is based on a mapping between email senders and ghost authors. This way a blog author can send from multiple email addresses (i.e. his office and private email account).
This mapping is described in the config/default.json
file. The file structure is like so:
{
"postAuthors": {
"[email protected]": {
"emailAddresses": ["[email protected]", "[email protected]", "[email protected]"]
},
"[email protected]": {
"emailAddresses": ["[email protected]"]
}
}
}
Things that need to be done:
- Test the blog creation by email with more diverse content. I.e. sending an email with inline pics, youtube links etc.
- Have more tests...
- Sending out emails when new blog posts are created