diff --git a/config/site_settings.yml b/config/site_settings.yml index ecaf08dd4b1..c0488ee7485 100644 --- a/config/site_settings.yml +++ b/config/site_settings.yml @@ -1104,6 +1104,9 @@ email: client: true default: true hidden: true + preserve_email_structure_when_styling: + default: false + hidden: true files: max_image_size_kb: diff --git a/lib/email/styles.rb b/lib/email/styles.rb index 69bfc7ec233..9b879b29d03 100644 --- a/lib/email/styles.rb +++ b/lib/email/styles.rb @@ -242,7 +242,12 @@ module Email strip_classes_and_ids replace_relative_urls replace_secure_media_urls - include_body? ? @fragment.at("body").to_html : @fragment.at("body").children.to_html + + if SiteSetting.preserve_email_structure_when_styling + @fragment.to_html + else + include_body? ? @fragment.at("body").to_html : @fragment.at("body").children.to_html + end end def include_body?