Github user btwood commented on a diff in the pull request:
https://github.com/apache/nifi/pull/2111#discussion_r136565224
--- Diff:
nifi-nar-bundles/nifi-email-bundle/nifi-email-processors/src/main/java/org/apache/nifi/processors/email/ExtractEmailAttachments.java
---
@@ -131,11 +132,15 @@ public void process(final InputStream rawIn) throws
IOException {
MimeMessageParser parser = new
MimeMessageParser(originalMessage).parse();
// RFC-2822 determines that a message must have a
"From:" header
// if a message lacks the field, it is flagged as
invalid
- Address[] from = originalMessage.getFrom();
+ if
(InternetAddress.parseHeader(originalMessage.getHeader("From", ","), false) ==
null) {
+ if
(InternetAddress.parseHeader(originalMessage.getHeader("Sender", ","), false)
== null) {
--- End diff --
I have a large corpus of mail to search for that. I can search for messages
with a "Sender" header. The reason I did this however was to try and mimic
"getFrom()" but without using the "strict" setting. So this is basically does
the same thing getFrom() does, manually.
I was using the following grepcode for a closer look:
http://grepcode.com/file/repo1.maven.org/maven2/org.apache.geronimo.specs/geronimo-javamail_1.4_spec/1.1/javax/mail/internet/MimeMessage.java#MimeMessage.getFrom%28%29
I guess the caveat there is that geronimo-javamail may be different
implementation than openJDK javamail.
The mail server may not be the one setting the From/Sender header. That is
often decided by the client. I suppose a sufficiently old mail client might set
Sender instead. My understanding from the code is that they were synonymous.
I'll re-read the RFC to see if that is the case.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---