Find Attachments, dont matter the content-type msg #25
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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: [email protected]
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.