Fixed email option issues

This commit is contained in:
Ben Ramey
2014-04-14 22:32:31 -05:00
parent 86ff69510e
commit 3ded2ab583
2 changed files with 7 additions and 6 deletions

View File

@@ -6,7 +6,8 @@ exports.sendRunEmails = function(runData) {
+ runData.name + "'! \n\n Put in your order here:\nhttp://www.lunchrun.me/#/run/" + runData.name + "'! \n\n Put in your order here:\nhttp://www.lunchrun.me/#/run/"
+ runData.id + "/order/"; + runData.id + "/order/";
var options = { var options = {
from: runData.creatorName + " <" + runData.creatorEmail + ">", fromname: runData.creatorName + " via LunchRun.me",
from: sails.config.email.fromAddress,
subject: "You've been invited to a lunch run!", subject: "You've been invited to a lunch run!",
replyto: runData.creatorEmail replyto: runData.creatorEmail
}; };
@@ -15,12 +16,13 @@ exports.sendRunEmails = function(runData) {
for (var idx in runData.invitees) { for (var idx in runData.invitees) {
var invitee = runData.invitees[idx]; var invitee = runData.invitees[idx];
var specificOptions = options; var specificOptions = options;
specificOptions.to = invitee.name + " <" + invitee.email + ">"; specificOptions.to = invitee.email;
specificOptions.toname = invitee.name;
specificOptions.text = emailText + invitee.name; specificOptions.text = emailText + invitee.name;
console.log(specificOptions); console.log(specificOptions);
sendgrid.send(specificOptions, function(err, response) { sg.send(specificOptions, function(err, response) {
if (err) { if (err) {
console.log(err); console.log(err);
} else { } else {
@@ -28,6 +30,4 @@ exports.sendRunEmails = function(runData) {
} }
}); });
} }
transport.close();
}; };

View File

@@ -3,5 +3,6 @@
// //
module.exports.email = { module.exports.email = {
apiUser: "benjaminramey", apiUser: "benjaminramey",
apiKey: "AVidasUPthub6pY3fFGe" apiKey: "AVidasUPthub6pY3fFGe",
fromAddress: "ben.ramey@gmail.com"
}; };