【发布时间】:2016-11-08 06:56:24
【问题描述】:
我通过gloda模块函数MsgHdrToMimeMessage接收附件
MsgHdrToMimeMessage(msgHdr, null, function(aMsgHdr, aMimeMsg) {
let attachments = aMimeMsg.parts[0].parts;
log(attachments);
}, false, {
saneBodySize: false,
});
如何使用 (imap: //) 链接将消息本地下载到计算机?
我尝试使用this。但我有错误。
MsgHdrToMimeMessage(msgHdr, null, function(aMsgHdr, aMimeMsg) {
try {
var attachments = aMimeMsg.allAttachments;
for (var [index, att] in Iterator(attachments)) {
var ioService = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
var attURL = null;
attURL = ioService.newURI(att.url, null, null);
attURL.QueryInterface(Ci.nsIMsgMessageUrl);
log(attURL)
var uri = attURL.uri;
// not work in this place.
// console.log: ReferenceError {}
var file = FileUtils.getFile("TmpD", [att.name]);
file.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, FileUtils.PERMS_FILE);
messenger.saveAttachmentToFile(file, att.url, uri, att.contentType, null);
}
} catch (err) {
log(err);
}
}, false, {
saneBodySize: false,
});
【问题讨论】:
标签: javascript email attachment thunderbird thunderbird-addon