Anybody having knowledge regarding the Email Parsing?? I have a requirement that i receive data from email and i need to split it. for ex: *Category : (Some Data) *Type : (Some Data) I need to separate the data accordingly and store the same.

3 Answers 3


Once you have your inbound email service set up, which is pretty easy to do if you just follow the docs, you'll need to write an inbound email handler class to process inbound email objects using the inbound email class.

You'll then want to set up a means to split your email body. Unless there's a common delimiter that you know you can count on, you'll want to use the Matcher Class along with RegEx to separate the data strings into Capture Groups for further processing. I've linked you to a site that will help you set up your RegEx expression.

Once you have the capture groups (strings), you can use various string methods as required from the string class to do what you need to get your data, such as splitting the strings using the colon following Category: or whatever strategy you feel makes the most sense to you then assigning the value to your field or a list for later dml processing.

There are plenty of examples of inbound email handlers for processing various types of data if you google them, so I won't include any code here.


You can write your own email handler. You'll find more information here and here

If you need to process the content of the email, you can do it in the handleInboundEmail method, using regex or whatever you need

Hope this helps


We decided on using Parserr.com finally to do this after finding this stackexchange post a few months ago.

Our case was a bit different as we had to extract row data (lead per row) from Excel using Parserr. But I believe they do email parsing too.

Full disclosure - through talking to the founder of the business, Im happy to vouch for them and help them along. Which is what Im doing here.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .