Tested with gmail. You can use other email service like mailjet, sendgrid, etc. It uses nodemailer. See note here about using gmail.
git clone https://github.com/arifsetiawan/simplemailer
cd simplemailer
npm install
DEBUG=app NODE_ENV=development EMAILHOST=smtp.gmail.com EMAILPORT=465 EMAILSECURE=true EMAILUSER=YOUREMAILUSER EMAILPASSWORD=YOUREMAILPASSWORD node app.js
Note
Replace YOUREMAILUSER, YOUREMAILPASSWORD with your own data
curl -X POST \
-H "Content-Type: application/json" \
-d '{"data":{"subject":"This is cool","to":["[email protected]","[email protected]"],"html":"<h1>Header</h1><p>Send email</p>"}}' \
http://localhost:8080/email
{
"data": {
"subject": "This is cool",
"to": ["[email protected]", "[email protected]"],
"html": "<h1>Header</h1><p>Send email</p>"
}
}
Data fields
subject
- requiredto
- required. Use array if there are multiple recipienthtml
- if set,text
will be generated from html contenttext
- if set,html
is ignored andtext
will be sendcc
- optional. Use array if there are multiple ccbcc
- optional. Use array if there are multiple bcc
- Add authentication
- Queue