Skip to content

Instantly share code, notes, and snippets.

@adkron
Created February 24, 2017 20:23
Show Gist options
  • Save adkron/fd01c7297cc79f1178443353432ee290 to your computer and use it in GitHub Desktop.
Save adkron/fd01c7297cc79f1178443353432ee290 to your computer and use it in GitHub Desktop.
const config = require('../../config.json')
const mandrill_api_key = config[process.env.NODE_ENV].mandrill_api_key
const mandrill = require('mandrill-api/mandrill')
const mandrill_client = new mandrill.Mandrill(mandrill_api_key)
const defaultEmailProperties = {
from_email: 'hello@evmatch.co',
from_name: 'EVmatch',
to: [
{email: 'founders@evmatch.com', name: 'Founders'},
],
tags: [''],
}
module.exports = {
sendVehicleChargeRequest: function(vehicleChargeRequest) {
email = Object.assign({}, defaultEmailProperties, {
subject: 'Charging Request',
text: `
start time: ${vehicleChargeRequest.start_time}
end time: ${vehicleChargeRequest.end_time}
user ID: ${vehicleChargeRequest.requester_id}
host ID: ${vehicleChargeRequest.host_id}
user email: Coming soon
host email: Coming soon
`,
})
mandrill_client.messages.send({
message: message,
async: true,
});
},
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment