Answers.Body: <p>This bug has been fixed in RC 4.7.31 -> <a href="https://github.com/civicrm/civicrm-core/pull/11661" rel="nofollow noreferrer">https://github.com/civicrm/civicrm-core/pull/11661</a></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-03-07T21:28:36.703Z
Answers.LastActivityDate: 2018-03-07T21:28:36.703Z
Answers.UserDisplayName: Luke Stewart
Body: <p>Is it possible to include line breaks in activities created from inbound emails, given that this is implemented in CiviCase? If so are there any suggestions about how to go about implementing this?</p>
  
  <p>Currently long emails, especially if replies are included result in a confusing block of text. This has previously been noted at <a href="https://civicrm.stackexchange.com/questions/11927/inbound-email-formatting-emails-with-htlm-code-are-ignored">Inbound Email - Formatting? (emails with HTLM code are ignored)</a>, However if the activity is saved to a case and then viewed the line breaks are shown.</p>
  
  <p>To reproduce.
  - Send an email (with line breaks/paragraphs) that will be recorded as an activity (<a href="https://civicrm.org/blog/dahndy/leveraging-civicrm-email-to-activity-processing-in-gmail" rel="nofollow noreferrer">https://civicrm.org/blog/dahndy/leveraging-civicrm-email-to-activity-processing-in-gmail</a> details how to with gmail)
  - View the associated activity on the associated contact (search for the email you send the email from)
  - Note that the email has line breaks/paragraphs removed.
  - Assign the email activity to a case
  - View the case - scroll down to the activites tab - view
  - The same content will be displayed with line breaks.</p>
  
  <p>My understanding is that the contact record Activity View uses the following to display the body of the email:
  {$values.details|crmStripAlternatives|nl2br}
  civicrm-core/templates/CRM/Activity/Form/ActivityView.tpl:138 </p>
  
  <p>Where as the CiviCase Activity view is using:
  {$form.details.html}
  civicrm-core/templates/CRM/Case/Form/Activity.tpl
  :64</p>
  
  <p>In the database the detail field for inbound email the record is stored as two ALTERNATIVE ITEM's the first as plain text with line breaks, the second with the full html of the inbound email.</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-02-15T01:34:52.977Z
Comments.Text: The "nl2br" part is intended to make the line breaks display. I'm not sure why it wouldn't be since you say the database first part has line breaks. For civicase I'm not sure that's the correct line in the file, but anyway I'd start by looking into whether the br's are actually being output in the underlying view-source for the non-case ones.
Comments.UserDisplayName: Demerit
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-02-15T10:19:21.363Z
Comments.Text: Hey Luke, I would like to answer this question in a helpful way but am having trouble doing so. The only question you have asked is "is it possible" and from what you wrote afterwards, I think you know that the answer is Yes :)
  Are you wanting to make the changes yourself and are stuck at a certain point? Is there anything else specific that you want to know the answer to?
Comments.UserDisplayName: michaelmcandrew
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-02-18T21:07:19.573Z
Comments.Text: I've edited question. Basically I'm keen to have a go at digging into this further in the code. I assume that there is probably some disparity between how line breaks are being handled - or it's getting the wrong part of the email from the crmStripAlternatives function.
Comments.UserDisplayName: Luke Stewart
Tags: <email><civicase><activity>
Title: Inbound email formatting differs in Activities compared to CiviCase
ThreadText: # Inbound email formatting differs in Activities compared to CiviCase
  
  (Asked by: username_0 on 2018-02-14)
  
  Is it possible to include line breaks in activities created from inbound emails, given that this is implemented in CiviCase? If so are there any suggestions about how to go about implementing this?
  
  Currently long emails, especially if replies are included result in a confusing block of text. This has previously been noted at [Inbound Email - Formatting? (emails with HTLM code are ignored)](https://civicrm.stackexchange.com/questions/11927/inbound-email-formatting-emails-with-htlm-code-are-ignored), However if the activity is saved to a case and then viewed the line breaks are shown.
  
  To reproduce.
  - Send an email (with line breaks/paragraphs) that will be recorded as an activity (<https://civicrm.org/blog/dahndy/leveraging-civicrm-email-to-activity-processing-in-gmail> details how to with gmail)
  - View the associated activity on the associated contact (search for the email you send the email from)
  - Note that the email has line breaks/paragraphs removed.
  - Assign the email activity to a case
  - View the case - scroll down to the activites tab - view
  - The same content will be displayed with line breaks.
  
  My understanding is that the contact record Activity View uses the following to display the body of the email:
  {$values.details|crmStripAlternatives|nl2br}
  civicrm-core/templates/CRM/Activity/Form/ActivityView.tpl:138
  
  Where as the CiviCase Activity view is using:
  {$form.details.html}
  civicrm-core/templates/CRM/Case/Form/Activity.tpl
  :64
  
  In the database the detail field for inbound email the record is stored as two ALTERNATIVE ITEM's the first as plain text with line breaks, the second with the full html of the inbound email.
  
  **Tags:** email, civicase, activity
  
  > **Comments:**
  > **username_1**: The "nl2br" part is intended to make the line breaks display. I'm not sure why it wouldn't be since you say the database first part has line breaks. For civicase I'm not sure that's the correct line in the file, but anyway I'd start by looking into whether the br's are actually being output in the underlying view-source for the non-case ones.  
  > **username_2**: Hey Luke, I would like to answer this question in a helpful way but am having trouble doing so. The only question you have asked is "is it possible" and from what you wrote afterwards, I think you know that the answer is Yes :) Are you wanting to make the changes yourself and are stuck at a certain point? Is there anything else specific that you want to know the answer to?  
  > **username_0**: I've edited question. Basically I'm keen to have a go at digging into this further in the code. I assume that there is probably some disparity between how line breaks are being handled - or it's getting the wrong part of the email from the crmStripAlternatives function.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2018-03-07. Score: 1 | Accepted answer
  
  This bug has been fixed in RC 4.7.31 -> <https://github.com/civicrm/civicrm-core/pull/11661>
  
  
  ---
  
  