Skip to content

Unable to parse SMTPUTF8 emails from EmailConverter #599

@mnmallea

Description

@mnmallea

Hi!
I'm trying to parse some emails that contain unescaped characters in the email headers. For example:

MIME-Version: 1.0
Message-ID: <[email protected]>
Subject: test
From: Test <[email protected]>
To: Martín Mallea <martí[email protected]>
Content-Type: multipart/alternative; boundary="0000000000004b527e05dbff4a78"

--0000000000004b527e05dbff4a78
Content-Type: text/plain; charset="UTF-8"

This is a test: ñ

--0000000000004b527e05dbff4a78
Content-Type: text/html; charset="UTF-8"

<div dir="ltr">This is a test: ñ</div>

--0000000000004b527e05dbff4a78--

After trying to parse it using EmailConverter#emlToEmail(InputStream inputStream) the characters in the From address don't get parsed properly.
This is usually fixed by setting the mail.mime.allowutf8 property to true. Unfortunately this is not posible now since the parser is using this createDummySession method:

	private static Session createDummySession() {
		return Session.getInstance(new Properties());
	}

This is not letting me override the properties that the session is using. Do you think that the we could have a way in which I can set the converter to use my own session? Or maybe taking the properties from system properties like this Session.getInstance(new Properties(System.getProperties())) so I can override them?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions