commit
6640da895d
1 changed files with 6 additions and 3 deletions
|
|
@ -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({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue