Support Questions

Find answers, ask questions, and share your expertise

Nifi extract Email Attributes

avatar
Expert Contributor

Hello

I am using Nifi to ingest my hdfs cluster with emails (.msg) and i want to be able to extract custom attributes these emails have like (From, To, Title etc..). How should i approach this?

I also want to create directories in my hdfs destination through nifi based on these attributes. Is this possible?

Thanks

Ahmad

1 ACCEPTED SOLUTION

avatar

You could use existing processors such as ExtractText for some types of emails to extract attributes which you can then use for routing. Or you could use the scripting processors and write your own code to extract features of the emails as attributes then use RouteOnAttribute. In the NiFi community there was recently work merged https://issues.apache.org/jira/browse/NIFI-1899 which looks like it will help a lot. For now, probably the best approach is to use ExecuteScript or InvokeScript to put together a quick e-mail parsing processor.

Thanks

View solution in original post

2 REPLIES 2

avatar

You could use existing processors such as ExtractText for some types of emails to extract attributes which you can then use for routing. Or you could use the scripting processors and write your own code to extract features of the emails as attributes then use RouteOnAttribute. In the NiFi community there was recently work merged https://issues.apache.org/jira/browse/NIFI-1899 which looks like it will help a lot. For now, probably the best approach is to use ExecuteScript or InvokeScript to put together a quick e-mail parsing processor.

Thanks

avatar
Expert Contributor

Thank you for your answer. These attributes are part of the metadata of the .msg file. Shouldn't the updateattributes processor be able to extract them? i tried it but it didnt work.