Hey all!
So I am trying to send a notification e-mail when a new field is inserted into a collection in order to alert the a user they have a class to schedule. Though the insert is only occurring 3 times, it is sending each email twice.
Below is my Scema code, how can I make sure this only sends once on initial insert?
notified:{
//idealy we will store the id of the email sent that contains all the data.. including to see if that email was opened w/ a trcker
type: String,
autoValue: function(){
if(this.isInsert && (!this.isSet || this.value.length === 0)){
Meteor.call('sendEmail', toEmailVar, fromEmailVar , 'sub', 'msg', (err) =>{
if(err)
return "no";
});
return "yes";
}
}
}