Skip to content

Find Attachments, dont matter the content-type msg#25

Open
marcospgmelo wants to merge 5 commits intoDusanKasan:masterfrom
marcospgmelo:master-marcospgmelo
Open

Find Attachments, dont matter the content-type msg#25
marcospgmelo wants to merge 5 commits intoDusanKasan:masterfrom
marcospgmelo:master-marcospgmelo

Conversation

@marcospgmelo
Copy link
Copy Markdown

@marcospgmelo marcospgmelo commented Sep 23, 2020

I was trying to read an Email with a file.txt in attachment.

But, when the code run and see every kind of content-type, the searching for attachments was missed.

putting the search out of the "IF's chain", the message got all my attachment's.

As you can see the in case below:

_Subject: myTestFile txt
To: test@example.com.br
Content-Type: multipart/mixed; boundary="00000000000028c8b805affc4d1e"

--00000000000028c8b805affc4d1e
Content-Type: multipart/alternative; boundary="00000000000028c8b705affc4d1c"

--00000000000028c8b705affc4d1c
Content-Type: text/plain; charset="UTF-8"

--00000000000028c8b705affc4d1c
Content-Type: text/html; charset="UTF-8"


--00000000000028c8b705affc4d1c--
--00000000000028c8b805affc4d1e
Content-Type: text/plain; charset="US-ASCII"; name="myTestFile.txt"
Content-Disposition: attachment; filename="myTestFile.txt"
Content-Transfer-Encoding: base64
Content-ID: <f_kffi1n1v0>
X-Attachment-Id: f_kffi1n1v0_

once the program search for the text/plain, the attachment was been ignored.

Decode text/plain and text/html body with encoding
use case-insensitive string to compare the encoding fields like Conte…
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

Successfully merging this pull request may close these issues.

3 participants