+ Start a Discussion
sateesh.nakerakantisateesh.nakerakanti 

Can any one help me with HTML email body Parsing in Apex

AshwaniAshwani
There is no Native way to do this, apex doesn;t support HTML parsing but you can use regex to remove all HTML tags as:
 
string html = 'your html code';

//regular expression to match all HTML/XML tags
string HTML_TAG_PATTERN = '<.*?>';

// compile the pattern     
pattern myPattern = pattern.compile(HTML_TAG_PATTERN);

matcher myMatcher = myPattern.matcher(result);

//remove all tags and convert to plane
result = myMatcher.replaceAll('');