Send emails using mailgun and plain text templates
$ npm install textmail
First create a mailer with some configuration:
var TextMail = ;var mailer =
Now you have a mailer - you can create 'emails' - these are functions that can be run to send the content to a recipient.
// create an email object that will render 'contact.txt' and// send it to 3 people with 'Contact Form Submission' as the subjectvar contact = mailer;app
The templates are ejs files - this means you can pass data from the vars:
This is an email template for <%= title %>It can also access root vars: <%= num %>
Create a new mailer with the following options:
Create a new email that will be sent to each email in the to_emails array.
The template can be a path relative to the 'template_root' or can be a full path.
The template is rendered using ejs.
Send the email by running it as a function passing the from address and the extra variables to render into the template
Add an extra email (or array of emails) to the list of address the email is sent to