Community Articles

Find and share helpful community-sourced technical articles.
Celebrating as our community reaches 100,000 members! Thank you!
Labels (1)
Master Guru

With Apache NiFi 1.0 you can now act as a simple SMTP server (though it is recommended to sit behind a real SMTP MTA and just get mail forwards). It makes for an easy way to ingest mail, headers and attachments.

The first thing you will notice is the awesome new UI, which is much cleaner and a joy to use.'


First add a processor, ListenSMTP, this will be your mail gateway/SMTP server. As you can see there's also processors for extracting attachments and headers from Email.


You need to make sure you set Listening Port, SMTP hostname and Max. # of Connections.



The entire flow for mail processing is pretty simple, but easy to follow. We listen for SMTP over TCP Port (I chose 2025, but with Root access you could run on 25). I send the original flow file right to HDFS. I extract the attachments and put them in a separate HDFS directory and finally pull out the email headers and also send them to an HDFS file. I have a little test flow in the bottom to read a file and send email to our ListenSMTP for testing.

If you are running this on an HDP 2.4 sandbox, you will need to install Java 8 and set it as an alternative JDK.

alternatives --config java

Pick Java 8

I added Java 8 as an alternative and specified Java_HOME in top of bin/ so I could run with Java 8 which is required now.

To send a test SMTP message from the command line:

telnet localhost 2025
Connected to localhost.
Escape character is '^]'.
220 ESMTP Apache NiFi
ehlo sandbox
250-SIZE 67108864
250 Ok
FROM: <>
250 Ok
250 Ok

354 End data with

250 Ok

A better way to test SMTP is with SWAKS See:

From Mac: brew install swaks

From Centos/RHEL: sudo yum -y install swaks

Test Send Email:

swaks --to --server localhost:2025
Received: from hw13125.home (localhost [])  
by  with SMTP (Apache NiFi) id IRPEF4WI  
for;  Wed, 10 Aug 2016 17:19:12 -0400 (EDT)
Date: Wed, 10 Aug 2016 17:19:12 -0400To:
From: tspann@hw13125.home
Subject: test Wed,
10 Aug 2016 17:19:12 -0400
X-Mailer: swaks v20130209.0
MIME-Version: 1.0
Content-Type: multipart/mixed; 
Content-Type: text/plain
This is a test mailing
Content-Type: application/octet-stream
Content-Disposition: attachment


It is very easy to configure send an email message to our server you need to put in a hostname and port.



Once your down building your flow, make sure you create a template and save the XML off to version control.


Creating a template has now moved to the Operate control.

If you get lost on what you are working for you can use the search feature from the top right.


Remember this is a beta product, not yet ready for production. Wait for HDF 2.0 for supported production usage.