Showing new lines on editing mail body

I created a email activity using emails v3 api. Below is the api request

{
 "properties": {
 "hs_email_status": "SENT",
 "hubspot_owner_id": "<owner field1>",
 "hs_email_subject": "Test email 1",
 "hs_timestamp": 1713790093935,
 "hs_email_html": "Message :<div style=\"font-size: 24px; font-family: Comic Sans MS; line-height: normal\"><div>sample mail from dev 1</div><div>new line 1</div><div><br></div><div><br></div><div>new line 2 - 2 new lines above</div></div><br><div class=\"opsigncontdiv\" id=\"opsigncontdiv\" style=\"font-size: 24px; font-family: Comic Sans MS; line-height: normal\"><div dir=\"ltr\"><p dir=\"ltr\" style=\"color: #222222; line-height: 1.38; margin-top: 0; margin-bottom: 0\"><span style=\"font-family: "Helvetica Neue"; vertical-align: baseline; white-space: pre-wrap; background-color: rgba(0, 0, 0, 0)\"><span style=\"background-color: rgba(0, 0, 0, 0)\"><font color=\"#000000\" size=\"4\">",
 "hs_email_direction": "EMAIL",
 "hs_email_headers": "{\"from\":{\"email\":\"farooq.m@outplayhq.com\",\"firstName\":\"Outplay Tes\"},\"to\":{\"email\":\"smsactstesp4@martinz.co.in\"}}"
 },
 "associations": [
 {
 "to": {
 "id": "<contact id>"
 },
 "types": [
 {
 "associationCategory": "HUBSPOT_DEFINED",
 "associationTypeId": 198
 }
 ]
 }
 ]
}

Activity is showing properly in UI, but when trying to edit the same activity, its adding new lines

Any idea on how to handle this? Thanks

Hey @OutplayHSInte1, thank you for posting in our Community!

To include new lines in the email body when editing the mail, you can modify the hs_email_html property in your API request. Currently, your email body contains HTML markup that represents line breaks using <div> elements and <br> tags. If you want to add additional new lines, you can simply include more <br> tags or <div> elements with appropriate styling.

I hope this information helps,

Pam

@PamCotton can you please provide your inputs on this?

Hi @PamCotton,
No, the issue is on HS UI, I am able to see email format properly, but when editing the activity I see additonal new lines (not sure from where these new lines are being added).

Activity from HS UI after adding from api:

When I click edit for this activity, I see in textbox its adding new lines (Please compare above and below screenshot, where you can see new lines being added automatically by HS)

Please let me know if you need any more details.

Hey @OutplayHSInte1, It seems like you’re encountering an issue where additional new lines are being added when editing an email activity in the HubSpot UI. This could be caused by how the API formats the text or how the HubSpot editor interprets line breaks. I recommend checking the formatting of the text being sent via the API to ensure there are no hidden characters or extra spaces. If the issue persists, it might be worth reaching out to HubSpot support to investigate if it’s a UI-specific bug.

Kindly.

Pam