I am using the presending event of InboxSDK to check for a condition before sending the email. For the case selectedProject!==0, email is not getting sent. Does anyone have any comments.
composeView.on('presending', (event) => {
if(selectedProject!==0){
//console.log(selectedProject);
composeView.send();
}else{
console.log(selectedProject);
event.cancel();
console.log('please select a project for the email');
alert('please select a project for the email');
initDropdown();//show the dropdown to select projects
}
From the presending handler if you want to send, you need to end the function by returning, if you call
composeView.send();it gets on a cycle calling the presending handler again.If you want to send later, you need to set a flag that is checked on the presending event to avoid running it again.
I know it's a bit late, but I hope this helps.