Hey All,
I’m trying to send 100 emails as fast as possible. Following is my code
let sendEmail = function(emails, content) {
Meteor.setTimeout(Meteor.bindEnvironment(()=>{
let to = 'myemail@somewhercom';
try {
Email.send({
to: to,
from: 'info@mydomain.com',
subject: 'Testing here',
html: '<h1>Hello</h1>'
});
} catch(e) {
console.log(e, to);
}
})
);
};
And from my server method is as follows
campaign.sendEmails': function(campaignId, subscribers) {
check(campaignId, String);
check(subscribers, Array);
this.unblock();
for (var i = 100 - 1; i >= 0; i--) {
console.log('hello, ', i);
try {
sendEmail();
} catch (e) {
return e;
}
}
}
This is only testing code
I have no way to see if the Email.send
has completed or not ?!?
Any thoughts guys ?