Skip to content

Instantly share code, notes, and snippets.

@ondrej-kvasnovsky
Last active August 3, 2021 17:34
Show Gist options
  • Save ondrej-kvasnovsky/6113201 to your computer and use it in GitHub Desktop.
Save ondrej-kvasnovsky/6113201 to your computer and use it in GitHub Desktop.
How to send email from Meteor JS framework.
Template.welcomePage.events({
'click #send-email-button': function () {
var email = {
to: 'xyz@failtracker.com',
from: 'abc@failtracker.com',
replyTo: 'abct@failtracker.com',
subject: "test email",
text: "hello lover boy"
};
Meteor.call('sendEmail', this.userId, email);
}
});
Meteor.methods({
sendEmail: function (userId, email) {
if (this.userId == userId) {
Email.send(email);
}
}
});
<template name='welcomePage'>
<a id='send-email-button'>Send email</a>
</template>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment