Resolve #248 View eml attachments

This commit is contained in:
the-djmaze 2022-05-11 23:13:24 +02:00
parent 17de4268b0
commit e205a0d3e0
4 changed files with 62 additions and 64 deletions

View file

@ -1,6 +1,7 @@
import { ParseMime } from 'Mime/Parser';
import { AttachmentModel } from 'Model/Attachment';
import { EmailModel } from 'Model/Email';
import { FileInfo } from 'Common/File';
import { BEGIN_PGP_MESSAGE } from 'Stores/User/Pgp';
@ -16,6 +17,17 @@ export function MimeToMessage(data, message)
let html = struct.getByContentType('text/html');
html = html ? html.body : '';
if (struct.headers.subject) {
message.subject(struct.headers.subject.value);
}
['from','to'].forEach(name => {
if (struct.headers[name]) {
let mail = new EmailModel;
mail.parse(struct.headers[name].value);
message[name].push(mail);
}
});
struct.forEach(part => {
let cd = part.header('content-disposition'),
cid = part.header('content-id'),