This is an email service built on top of Mailchimp/Mandrill to enable serverless landing pages.
You can see an example here.
It's built on top of stdlib – a microservice provider.
This function will subscribe a user to the given Mailchimp list id. You have to have the following environment variables set:
MAILCHIMP_KEY
– API Key for Mailchimp.MAILCHIMP_LIST_ID
– List ID from Mailchimp.
This function will send an email either using a template or just a plain email from the html/text given to the given user. You have to set the following environment variable on the service:
MANDRILL_KEY
– API Key for Mandrill.
Here's an example message send. See the docs for sendTemplate and send for the full params.
const lib = require('lib');
lib['./send']({
message: {
to: [{
email: "[email protected]",
name: "Nima Gardideh",
type: "to"
}],
headers: {
"Reply-To": "[email protected]"
},
subject: "This is a test email!",
from_email: "[email protected]",
from_name: "Nima",
html: "<p>This is an email sent from a stdlib email service.</p>",
text: "This is an email sent from a stdlib email-service."
}
}, console.error)