Hi,
I'm writing thunderbird extension which redirect selected mail from Inbox to another mailbox. I've already done: extracting body from mail and attachments from mail. Setting up new subject, reply-to, from, to sections.
My last problem is that if in the body are some embedded attachments they won't apear in the body of new redirected mail.
Maybe I should code this html body?
Or maybe is there any posibility to save them like normal attachments? But what next? How to embed them at the right place in htmlBody?
Or that cannot be done and I have to find another way to read whole body and header?
There is some of my code:
MsgHdrToMimeMessage(msgHdr, null, function (aMsgHdr, aMimeMsg) {
try {
var attachments = aMimeMsg.allUserAttachments || aMimeMsg.allAttachments;
for (var [index, att] in Iterator(attachments))
{
var ioService = Components.classes["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService);
var attURL = null;
attURL = ioService.newURI(att.url, null, null);
attURL.QueryInterface(Components.interfaces.nsIMsgMessageUrl);
var uri = attURL.uri;
var file = FileUtils.getFile("TmpD", [att.name]);
file.createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, FileUtils.PERMS_FILE);
messenger.saveAttachmentToFile( file, att.url, uri, att.contentType, null );
var attach = Components.classes["@mozilla.org/messengercompose/attachment;1"].createInstance(Components.interfaces.nsIMsgAttachment);
attach.url = "file://" + file.path;
params.composeFields.addAttachment(attach);
}
var composeService = Components.classes["@mozilla.org/messengercompose;1"].getService(Components.interfaces.nsIMsgComposeService);
//composeService.OpenComposeWindowWithParams(null, params);
var sendIt = composeService.initCompose(params, null, null);
sendIt.SendMsg(Components.interfaces.nsIMsgCompDeliverMode.Now, id, null, null, null);
} catch (err) {
alert(err);
}
}, true, { examineEncryptedParts: true });
[Thunderbird] save Embedded Attachments
-
- Posts: 1168
- Joined: September 16th, 2007, 8:01 am
Re: [Thunderbird] save Embedded Attachments
This is the place to get all the expert TB addon dev help https://groups.google.com/forum/#!forum ... hunderbird