Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/firstandthird/micro-mail
Micro email api
https://github.com/firstandthird/micro-mail
app
Last synced: 14 days ago
JSON representation
Micro email api
- Host: GitHub
- URL: https://github.com/firstandthird/micro-mail
- Owner: firstandthird
- Created: 2016-04-28T14:55:27.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2022-12-30T17:13:47.000Z (about 2 years ago)
- Last Synced: 2024-04-16T00:42:30.686Z (10 months ago)
- Topics: app
- Language: JavaScript
- Size: 1.06 MB
- Stars: 3
- Watchers: 6
- Forks: 1
- Open Issues: 21
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Micro Mail
An app for sending emails.
### Setup
Clone this repo and `npm install`. In order to work, the rendering engine must be able to find all of your templates. Currently all template files are defaulted to exist in `./templates`. Any additional helpers can be installed in `./helpers`. See below.
```
./micro-mail
+ -- templates
| + -- emails
| | + -- template-folder
| | | + -- index.html
| | | + -- details.yaml
| | | + -- test.json
| + -- partials
| | + -- header.html
| | + -- footer.html (Example files)
+ -- helpers
| + -- inline.js
| + -- example.js
```Additionaly, you can configure where you want the files to reside in `conf/default.yaml` or in an environment specific file similar to `conf/dev.yaml` or `conf/stage.yaml`.
### API
`POST /send`
Payload:
```
{
to: [*String],
from: [String],
fromName: [String],
subject: [String],
template: [*String],
data: [Object],
text: [*String],
headers: [Object]
}
```Attribute | Req. | Description
--- | --- | ---
**to** | *yes* | The email address of the recipient.
**from** | *no* | The email address of the sender. Overrides configured sender.
**fromName** | *no* | The common name of the sender. Override the configured name.
**subject** | *no* | The subject line of the email. Overrides the subject in the template configuration.
**template** | *yes* | The slug of the template you wish to render and send. Required if `text` is empty.
**data** | *no* | Data object that is passed to the template rendering engine. Not specifically required unless your email template requires it to render properly.
**text** | *yes* | Content to be sent as a text based email. If set, a text based email will be send regardless of the value of `template`.
**headers** | *no* | Additional headers that are sent to the email delivery agent.Response
```
{
status: [String (ok|error)],
message: [String],
result: [String|Object]
}
```Attribute | Description
--- | --- | ---
`status` | An enumeration of the request status. `ok` for a successful transaction, and `error` if there was an error. The HTTP status code will also reflect this status (`200` for `ok`, `4**`, `5**` for error)
`message` | A Pretty message from the system.
`result` | A proxy result from the mailing system. I.E. response from the Mandrill API.-----