I have multi-line String(email) that I have to parse. I would like to get the below information from the string using Scala. Sometimes, few lines could be missing like the “To:” line in the email and the code should be able to handle that.
MessageId = 26025617.9085860263913.JavaMail.gia@basi
MessageDate = Mon, 20 Aug 2012 06:02:09 -0800 (PST)
MessageFrom = firstname.lastname@example.org
MessageTo = email@example.com
MessageSubject = Various Offers
val strMail = “”"Message-ID: 26025617.9085860263913.JavaMail.gia@basi
Date: Mon, 20 Aug 2012 06:02:09 -0800 (PST)
Subject: Various Offers
Content-Type: text/plain; charset=us-ascii
X-From: Matt, Spartz </O=GMAIL/OU=NA/CN=RECIPIENTS/CN=MSPARTZ2>
X-To: Dave, Edgar </O=YAHOO/OU=NA/CN=RECIPIENTS/CN=Dedgar>
X-Folder: \Dedgar (Non-Privileged)\Edgar, Dave\Inbox
X-FileName: DEDGAR (Non-Privileged).pst
Do you think you’ll have a chance to work on the various offers today? If not, could you give me an idea of when this week you think you’ll have some time.
Any help? Thanks.