Github user trixpan commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/827#discussion_r74362612
  
    --- Diff: 
nifi-nar-bundles/nifi-email-bundle/nifi-email-processors/src/main/java/org/apache/nifi/processors/email/ListenSMTP.java
 ---
    @@ -13,89 +13,52 @@
      *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 
implied.
      *  See the License for the specific language governing permissions and
      *  limitations under the License.
    -*/
    + */
     package org.apache.nifi.processors.email;
     
    -import javax.net.ssl.SSLContext;
    -import javax.net.ssl.SSLSocket;
    -import javax.net.ssl.SSLSocketFactory;
     import java.io.IOException;
    -import java.io.InputStream;
    +import java.io.OutputStream;
     import java.net.InetSocketAddress;
     import java.net.Socket;
     import java.util.ArrayList;
    -import java.util.Collection;
     import java.util.Collections;
    -import java.util.HashMap;
     import java.util.HashSet;
     import java.util.List;
    -import java.util.Map;
     import java.util.Set;
    -import java.util.concurrent.LinkedBlockingQueue;
     import java.util.concurrent.TimeUnit;
    -import java.util.concurrent.atomic.AtomicBoolean;
    -
    -import org.apache.commons.lang3.StringUtils;
    -
    -import org.subethamail.smtp.server.SMTPServer;
    -
    -
    -import org.apache.nifi.annotation.lifecycle.OnStopped;
    -import org.apache.nifi.annotation.lifecycle.OnUnscheduled;
    -import org.apache.nifi.flowfile.attributes.CoreAttributes;
    -import org.apache.nifi.processor.DataUnit;
    +import java.util.concurrent.atomic.AtomicInteger;
     
    -import org.apache.nifi.annotation.lifecycle.OnScheduled;
    -import org.apache.nifi.components.PropertyDescriptor;
    -import org.apache.nifi.processor.AbstractProcessor;
    -import org.apache.nifi.processor.ProcessorInitializationContext;
    -import org.apache.nifi.processor.Relationship;
    -import org.apache.nifi.processor.util.StandardValidators;
    +import javax.net.ssl.SSLContext;
    +import javax.net.ssl.SSLSocket;
    +import javax.net.ssl.SSLSocketFactory;
     
    +import org.apache.commons.io.IOUtils;
     import org.apache.nifi.annotation.behavior.InputRequirement;
    -import org.apache.nifi.annotation.behavior.WritesAttribute;
    -import org.apache.nifi.annotation.behavior.WritesAttributes;
     import org.apache.nifi.annotation.documentation.CapabilityDescription;
     import org.apache.nifi.annotation.documentation.Tags;
    +import org.apache.nifi.annotation.lifecycle.OnStopped;
    +import org.apache.nifi.components.PropertyDescriptor;
    +import org.apache.nifi.flowfile.FlowFile;
    +import org.apache.nifi.processor.AbstractSessionFactoryProcessor;
    +import org.apache.nifi.processor.DataUnit;
     import org.apache.nifi.processor.ProcessContext;
     import org.apache.nifi.processor.ProcessSession;
    +import org.apache.nifi.processor.ProcessSessionFactory;
    +import org.apache.nifi.processor.Relationship;
     import org.apache.nifi.processor.exception.ProcessException;
    -import org.apache.nifi.components.ValidationContext;
    -import org.apache.nifi.components.ValidationResult;
    -import org.apache.nifi.flowfile.FlowFile;
    +import org.apache.nifi.processor.io.OutputStreamCallback;
    +import org.apache.nifi.processor.util.StandardValidators;
     import org.apache.nifi.ssl.SSLContextService;
    -
    -import org.apache.nifi.processors.email.smtp.event.SmtpEvent;
    -import org.apache.nifi.processors.email.smtp.handler.SMTPResultCode;
    -import 
org.apache.nifi.processors.email.smtp.handler.SMTPMessageHandlerFactory;
    +import org.subethamail.smtp.server.SMTPServer;
     
     @Tags({"listen", "email", "smtp"})
     @InputRequirement(InputRequirement.Requirement.INPUT_FORBIDDEN)
    -@CapabilityDescription("This processor implements a lightweight SMTP 
server to an arbitrary port, " +
    -        "allowing nifi to listen for incoming email. " +
    -        "" +
    -        "Note this server does not perform any email validation. If direct 
exposure to the internet is sought," +
    -        "it may be a better idea to use the combination of NiFi and an 
industrial scale MTA (e.g. Postfix)")
    -@WritesAttributes({
    -        @WritesAttribute(attribute = "mime.type", description = "The value 
used during HELO"),
    -        @WritesAttribute(attribute = "smtp.helo", description = "The value 
used during HELO"),
    -        @WritesAttribute(attribute = "smtp.certificates.*.serial", 
description = "The serial numbers for each of the " +
    -                "certificates used by an TLS peer"),
    -        @WritesAttribute(attribute = "smtp.certificates.*.principal", 
description = "The principal for each of the " +
    -                "certificates used by an TLS peer"),
    -        @WritesAttribute(attribute = "smtp.from", description = "The value 
used during MAIL FROM (i.e. envelope)"),
    -        @WritesAttribute(attribute = "smtp.to", description = "The value 
used during RCPT TO (i.e. envelope)"),
    -        @WritesAttribute(attribute = "smtp.src", description = "The source 
IP of the SMTP connection")})
    --- End diff --
    
    See how the original MAIL FROM data is fully lost while the rest now needs 
to be processed via RegEx to the detriment of the user?
    
    RFC-2822 clearly distinguishes the nature of both sets of data, reason 
while nearly every single SMTP server will provide you with the option of 
logging the details provided during the SMTP exchange (envelope), while mail 
parsers will usually look into the Headers of the message (EmailExtractHeaders 
does that) 
    
    > 
    >       MAIL FROM:<>
    > 
    >    As discussed in section 2.4.1, a relay SMTP has no need to inspect or
    >    act upon the headers or body of the message data and MUST NOT do so
    >    except to add its own "Received:" header (section 4.4) and,
    >    optionally, to attempt to detect looping in the mail system (see
    >    section 6.2).
    > 


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to