Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible problem with parsing Mime Part Boundary #278

Closed
jhumphries83 opened this issue Jan 19, 2017 · 4 comments
Closed

Possible problem with parsing Mime Part Boundary #278

jhumphries83 opened this issue Jan 19, 2017 · 4 comments

Comments

@jhumphries83
Copy link

jhumphries83 commented Jan 19, 2017

I recently had a misbehaving mail client provide mail headers in the following format:

MIME-Version: 1.0
From: [email protected]
To: [email protected]
Date: 18 Jan 2017 16:40:27 +0000
Content-Type: multipart/mixed;
 boundary=--boundary_0_8ab0e518-760f-4a94-acc0-66f7cdea5c9f
 
Subject: A Test Email

Note the extra carriage return and space after the Content-Type header.

When using the MimeMessage.Load method MimeKit determined the Boundary to be "--boundary_0_8ab0e518-760f-4a94-acc0-66f7cdea5c9f " (it has included the space character from the line below the Content-Type header). This results in MimeKit not detecting any of the Mime parts in the message (which in turn means I cannot process it correctly).

However when I relay the message, other mail clients do detect the mime parts and display the message as intended. Which I assume means that they are ignoring the extra line and space after the Content-Type header.

I'm not sure if this means that the extra space character should be included as part of the boundary specifier or not. Unfortunately I couldn't find any information in the relevant RFC's (822, 2045) about how headers should be parsed in this scenario.

If I remove the extra line with the space before calling MessagePart.Load MimeKit detects the other MimeParts and I can process the message properly.

What are your thoughts? Do you think MimeKit should be adding the extra space to the end of the boundary specifier or ignoring the extra line and space?

jstedfast added a commit that referenced this issue Jan 19, 2017
@jstedfast
Copy link
Owner

Technically, that mail client is broken... but it is trivial to work around, so now the code works around that issue.

@jhumphries83
Copy link
Author

Great, that was quick! Many thanks! Do you know when a new release will next be available on nuget?

@jstedfast
Copy link
Owner

I was going to try and do another release around the end of the month

@jhumphries83
Copy link
Author

Perfect, Thanks again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants