Skip to content

MailParser simpleparser parses out "Forwarded message" section when decoding base64 #393

@lydiastepanek

Description

@lydiastepanek

On a recent email I was processing, I noticed that simpleParser removes the "---------- Forwarded message ---------" part of the email it parses, so that EmailForwardParser can't find the forwarded email within:

import { simpleParser } from "mailparser";
import EmailForwardParser from "email-forward-parser";

const parentEmail = await simpleParser(s3Object);
let forwardedEmail;
if (parentEmail.text) {
  forwardedEmail = new EmailForwardParser().read(parentEmail.text);
}
// forwardedEmail.forwarded is false when it should be true

[^ Code link: https://github.com/lydiastepanek/is-this-phishy/blob/9eb69c0f22d5bbacde08738bb9c39032798d614c/index.js#L30-L34 ]

Here's the email I was processing (s3Object above): https://gist.github.com/lydiastepanek/10c78098b763c60bae2b4308fd034323

Is this intentional behavior? Is there an option I can pass into simpleParser to keep the "---------- Forwarded message ---------" section of the email intact after getting parsed?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions