hello community
I want to parse the email raw format, and grab the plain text message body.
I did the job in python, such as this:
import email
import sys
file=sys.argv[1]
f = open(file, "r")
x = f.read()
b = email.message_from_string(x)
if b.is_multipart():
for part in b.get_payload():
print part.get_payload()
break
else:
print b.get_payload()
Because our spark jobs were written by scala, i want to translate the code into scala. But I didn’t find a right library for this. can you suggest?
Thanks for all the kind helps.