A RESTful service for sending templated e-mails upon request
- Install with:
npm i -g --no-optional mailgirl
. - Point
MAILGIRL_CONF
env var to a TOML config file. - Drop your EJS templates in a folder.
- Write your SMTP settings in the config file from previous step.
- Run in the terminal with:
mailgirl
.
The official image repository in Docker Hub is gcsboss/mailgirl
.
Run like this: docker run -p 10080:80 -v /your/conf.toml:/usr/src/app/conf.toml -v /your/templates:/usr/src/app/templates gcsboss/mailgirl
templatesDir = './templates'
port = 80
[log]
level = 'info'
file = './maigirl.log'
[smtp]
host = 'smtp.gmail.com'
port = 587
secure = true
[smtp.auth]
user = 'me@gmail.com'
pass = 'my-example-password'
POST /preview/:template-path
: Responds with the raw e-mail that would be sent.POST /mail/:template-path
: Actually sends the e-mail to the setup SMPT server.
The request body needs to be a JSON whose keys will be available for the given template to work with.
The EJS e-mail templates must consist of the following parts:
- First line: Subject
- Second line: From (allow quoted naming)
- Third line: To (allow comma separated lists)
- Rest of the lines: The atcual e-mail body
If you have found any problems with this module, please:
- Open an issue.
- Describe what happened and how.
- Also in the issue text, reference the label
~bug
.
We will make sure to take a look when time allows us.
If you wish to get that awesome feature or have some advice for us, please:
- Open an issue.
- Describe your ideas.
- Also in the issue text, reference the label
~proposal
.
If you have spotted any enhancements to be made and is willing to get your hands dirty about it, fork us and submit your merge request so we can collaborate effectively.