Meteor: How to use your own mailer template? -


hi guys have method follow:

meteor.methods({   sendemail: function (to, from, name, text) {      if (meteor.isserver) {         return meteor.mandrill.send({             to: to,             from: from,             name: name,             text: text         });     }   } }); 

this method called in contact.js (the html view contact.html):

if (meteor.isclient) {   // code runs on client   template.contact.events({     "click .btn": function(event) {       var  = document.getelementbyid('from').value;        var name  = document.getelementbyid('name').value;       var text  = document.getelementbyid('message').value;    meteor.call('sendemail', 'lolotutu@gmail.com', from, name, text);      }   });    template.contact.helpers({     test: "working"   }); 

everything work fine, have no control on template used send mail. using mandrill here , know how tell sendemail method serve custom template sent people. maybe session.set , session.get have trouble implementing it. thanks.

for defined template called yourcustomtemplate.html, can use following:

meteor.methods({   sendemail: function (to, from, name, text) {      if (meteor.isserver) {         return meteor.mandrill.send({             to: to,             from: from,             name: name,             text: text,             html: function(user,url){return spacebars.tohtml({user: user.name, url: url}, assets.gettext('yourcustomtemplate.html'))}         });     }   } }); 

the email formated sent html, text backup viewer cannot view html.


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -