Created
February 24, 2017 20:23
-
-
Save adkron/fd01c7297cc79f1178443353432ee290 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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