我正在为 Thunderbird 编写一个附加组件,并希望能够在某些条件下取消发送电子邮件。我有以下代码允许我在发送电子邮件之前执行代码,但我不知道如何停止它。
document.getElementById("msgcomposeWindow").addEventListener( "compose-send-message", function(){
var msgcomposeWindow = document.getElementById( "msgcomposeWindow" );
var msg_type = msgcomposeWindow.getAttribute( "msgtype" );
// do not continue unless this is an actual send event
if( !(msg_type == nsIMsgCompDeliverMode.Now || msg_type == nsIMsgCompDeliverMode.Later) )
return;
alert('Sending Message...');//works fine
if(true){ //eventually this would have more logic...
//stop email
}else{
//let email go
}
}, true );
我需要做什么才能停止发送电子邮件?