We have some EmailMessage
records where the htmlbody
field has its value from the textbody
of email records taken from Microsoft Outlook using the Graph API implying there should be no newline/line break characters.
So I query EmailMessage
records and run the following script in apex:
for (EmailMessage em : [select id, htmlbody from emailmessage]) {
if (
em.htmlbody == null
|| em.htmlbody.contains('<br>')
|| em.htmlbody.contains('<br/>')
|| em.htmlbody.contains('<br />')
|| em.htmlbody.contains('\\n')
|| em.htmlbody.contains('\\r')
) continue;
system.debug(em.htmlbody);
}
The problem I'm having upon logging to the console is that on the console, I see the emails with line breaks, as if they really have line breaks of some kind. Please see the very redacted screenshot below:
What am I missing here? I expect to see one long string of text whereas I see a string with line breaks.