A Node.js microservice for sending email to a whitelisted email address.
Works great with now.sh.
Start the service and send an email:
PORT=3000 node index.js
curl -X POST --data "fromName=Test&subject=Hi&body=Hello&[email protected]" http://localhost:3000/send
Clone somewhere then create an .env
file:
[email protected]
[email protected]
SMTP_HOST=email-smtp.us-east-1.amazonaws.com
SMTP_PORT=465
SMTP_USER=XXX
SMTP_PASSWORD=XXX
MAX_BODY_SIZE=10000
Deploy to now with:
now --dotenv
Or run locally:
node index.js
POST /send
The data payload can be JSON or URL-encoded (x-www-form-urlencoded).
fromName
- name of sendersubject
- email subjectbody
- plain-text email bodyreplyTo
(optional) - reply-to email