Merge branch 'bug/send_email_#66'

Fixes #66
This commit is contained in:
cleverbeagle 2017-09-30 08:32:09 -05:00
commit 6640da895d

View file

@ -1,3 +1,4 @@
import { Meteor } from 'meteor/meteor';
import { Email } from 'meteor/email';
import getPrivateFile from './get-private-file';
import templateToText from './handlebars-email-to-text';
@ -5,14 +6,16 @@ import templateToHTML from './handlebars-email-to-html';
const sendEmail = (options, { resolve, reject }) => {
try {
Meteor.defer(() => Email.send(options));
if (callback) resolve();
Meteor.defer(() => {
Email.send(options);
resolve();
});
} catch (exception) {
reject(exception);
}
};
export default ({ text, html, template, templateVars, ...rest }, callback) => {
export default ({ text, html, template, templateVars, ...rest }) => {
if (text || html || template) {
return new Promise((resolve, reject) => {
sendEmail({