mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-11-03 10:58:50 +03:00
Improved #2037
This commit is contained in:
parent
1cd80f94c7
commit
024343b612
2 changed files with 12 additions and 3 deletions
|
|
@ -75,9 +75,18 @@ export function ParseMime(text)
|
||||||
get raw() {
|
get raw() {
|
||||||
return text.slice(this.start, this.end);
|
return text.slice(this.start, this.end);
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
get headRaw() {
|
get headRaw() {
|
||||||
return Object.keys(this.headers || {}).length ? text.slice(this.start, this.bodyStart) : '';
|
return this.hasHeader ? text.slice(this.start, this.bodyStart) : '';
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
get hasHeader() {
|
||||||
|
for (const prop in this.headers) {
|
||||||
|
if (Object.hasOwn(this.headers, prop)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
get bodyRaw() {
|
get bodyRaw() {
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ import { EmailModel } from 'Model/Email';
|
||||||
export function MimeToMessage(data, message)
|
export function MimeToMessage(data, message)
|
||||||
{
|
{
|
||||||
const struct = ParseMime(data);
|
const struct = ParseMime(data);
|
||||||
if (struct.headRaw) {
|
if (struct.hasHeader) {
|
||||||
let html = struct.getByContentType('text/html'),
|
let html = struct.getByContentType('text/html'),
|
||||||
subject = struct.headerValue('subject');
|
subject = struct.headerValue('subject');
|
||||||
html = html ? html.body : '';
|
html = html ? html.body : '';
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue