Notifications

367 views

Incoming email HTML content and body text depend on the content type 

Problem
Some clients allow the creation of different HTML and text part on the emails, or auto-generate the missing HTML or text part of the email when it is sent.

 

Symptoms
When reviewing the sys_email records, in some cases the HTML body when previewed contains different information than the body text field.

 

Cause
Some clients allow the creation of different HTML and text part on the emails. When received, incoming emails are treated differently depending on the content type.

Given the HTML content, most clients will automatically create a text version. In that case, each HTML and text version is extracted from the incoming email and there is no need to generate either content. However, if the HTML content exists and the text version is not available, it is generated automatically. Similarly, if only the text content exists and the HTML version is not available, it is generated automatically.

Incoming email content type
Email body_html
Email body_textReason
text/plainGeneratedExtracted from email if availableBecause the HTML text is not available, it is generated based on the body_text
text/htmlExtracted from email if availableGeneratedBecause the TEXT version is not available, it is generated by stripping the HTML tags
MultipartExtracted from email if available or generatedExtracted from email if available or generatedThe available types text/plain or text/html are extracted on the multipart section



 content type on the email

Resolution
If either the body text or body (HTML) in the email do not match, validate the email content type to understand the source of the differences. If the text was auto-generated, the source is on the necessary conversion. However, if the incoming emails is multipart, validate whether the client sending the emails is causing the differences because the information is extracted on the email itself.

If you depend on the email body (HTML), ensure that clients are sending the text/html content correctly. If you depend on the body text, ensure that clients are sending the text/plain content on the emails.

 

Note: Validate whether the differences come from automatic systems integrating by email.

 

 

Article Information

Last Updated:2018-01-25 05:08:16
Published:2017-09-18