Created
May 1, 2016 23:11
-
-
Save bretth18/53f983377d70735215961a9f068a232c to your computer and use it in GitHub Desktop.
medium-4
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
if(Meteor.isServer){ | |
Meteor.methods({ | |
sendEmail:function(subForm){ | |
var sparky = new SparkPost(process.env.SPARKPOST_AUTHKEY); | |
sparky.transmissions.send({ | |
transmissionBody: { | |
content: { | |
from: '[email protected]', // take in users email for from | |
subject: subForm.email_val +' contacted you!', | |
html:'<html><body><h4>Name:'+ subForm.first_name + ' ' + subForm.last_name + '</h4><div></div><h4>Company: ' + subForm.company_val + '<div></div><p> Text: ' + subForm.message_val + '</p><div></div><a href="mailto:' + subForm.email_val + '">Reply</a></body></html>' | |
}, | |
recipients: [ | |
{address: '[email protected]'} | |
] | |
} | |
}, function(err, res) { | |
if (err) { | |
console.log('Whoops! Something went wrong sending an email'); | |
console.log(err); | |
} else { | |
console.log('Message sent via sparkpost on server'); | |
} | |
}); | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment