Skip to content

Commit

Permalink
Merge branch 'bug/send_email_#66'
Browse files Browse the repository at this point in the history
Fixes #66
  • Loading branch information
cleverbeagle committed Sep 30, 2017
2 parents 9116780 + b4165ed commit 6640da8
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions imports/modules/server/send-email.js
@@ -1,18 +1,21 @@
import { Meteor } from 'meteor/meteor';
import { Email } from 'meteor/email';
import getPrivateFile from './get-private-file';
import templateToText from './handlebars-email-to-text';
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({
Expand Down

0 comments on commit 6640da8

Please sign in to comment.