Failed to remove attachment in Thunderbird AddOn

128 views Asked by At

I try to remove a particular attachment which I know his path in var SomeAddOnName.MessengerCompose.filePathCurrent with the following instructions :

    //Construct reference attachment
    var fileAttachmentBefore = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsIFile);
    fileAttachmentBefore.initWithPath(SomeAddOnName.MessengerCompose.filePathCurrent);
    var attachmentBefore = FileToAttachment(fileAttachmentBefore);
    //Remove attachment
    gMsgCompose.compFields.removeAttachment(attachmentBefore);

but It doesn't work and gMsgCompose.compFields.attachments is still empty, whatever I do in mail composer.

Do anyone know what I must do ?

Thanks

0

There are 0 answers