Requirements:
- lodash (or underscore, you may need to change your _ functions to suit)
- Meteor email package
Meteor.startup(function () {
var sendEmail = _.bind(Email.send, Email);
_.extend(Email, {
send: function (options) {
if (/* your custom mail method exists */) {
/* your custom mail method, pull the options you need from `options` */
console.log('CUSTOM MAIL METHOD');
} else {
/* use the SMTP method */
console.log('DEFAULT MAIL METHOD');
sendEmail(options);
}
}
});
});
Seems to work, thanks for sharing! Note: this code is for server-side only.
Just missing another
});
at the end ;)