From d1de555169245215697105ee88c145801bb538c4 Mon Sep 17 00:00:00 2001 From: Ben Ramey Date: Sat, 22 Mar 2014 17:58:56 -0500 Subject: [PATCH] Emailing --- api/models/Run.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/api/models/Run.js b/api/models/Run.js index c8b9deb..7a86dae 100644 --- a/api/models/Run.js +++ b/api/models/Run.js @@ -41,13 +41,22 @@ module.exports = { }); var inviteeEmails = []; + for (var i in values.invitees) { - inviteeEmails.push(i.email); + var invitee = values.invitees[i]; + var emailStr = invitee.name + " <" + invitee.email + ">"; + inviteeEmails.push(emailStr); } + var options = { from: values.creatorName + " <" + values.creatorEmail + ">", - to: inviteeEmails + to: inviteeEmails.join(","), + subject: "A lunch run!", + text: "You've been invited to a lunch run!" }; + + console.log(options); + transport.sendMail(options, function(err, response) { if (err) { console.log(err); @@ -60,5 +69,4 @@ module.exports = { next(); }, - };