OpenAI Gmail inserting html tags into the email body

I am encountering an issue within an automation flow that involves crafting emails using OpenAI and then sending them through Gmail. The challenge arises when the email content transitions to the Gmail sending stage; instead of incorporating natural line breaks, the automation inserts HTML <br> tags, which compromises the professional appearance of the emails.

This formatting issue is critical as it affects the readability and professionalism of our communications. Could you please assist me in resolving this matter? I need the automation to preserve the intended formatting without injecting <br> tags where line breaks should be.

I am looking forward to any help on how to adjust the automation flow or the settings to ensure that the emails sent through Gmail maintain the correct formatting.

Hi there @Chris_Tucker and welcome to our community :star:

Would you mind mind sharing an example of the text that’s placed in the body input? just so it can be easier for us to understand the issue.

@Abdul Absolutely. The automation is not including any of the spacing and maintaining the html. It just doesnt look good. I want the output from either OpenRouter or OpenAI to look like it does in the chtabots output field with line breaks and spacing.

Here is how it looks:


Did you try using the body (html) instead of the body (Text) ? I know the body (text) input is required, just leave the same text there as well

Yes this gave an improved output but stilll everything is in one gaint paragraph. Still not an ideal output. I amk curious how to get the proper formatting into the email body. It would make for a much better presentation for professional purposes. :slight_smile:

Of course, can you please provide a screenshot of that ?

Let me check it once possible and come back to you

Hi there @Chris_Tucker , I just had the chance to do some testing, I copied the text you had in html and pasted it into the Body(HTML) input and got this result in the email


I think you might be using an outdated version of the Gmail piece, could you please remove it and add it again ?

1 Like

I’ve had this issue too actually from using the body (html), i resolved it by using HTML tags as it a static email not a dynamic one.

Maybe an easier solution for @Chris_Tucker is to ask ChatGPT to write the emails in HTML. and use that in the HTML section and use asterix “*” in the body (text) section this did the trick for me btw.

1 Like

When I get a chance I will take a look and update you. Thanks for the help :slight_smile:

I’m glad I’m not the only one with this kind of issue.

I asked for markdown text and the ChatGPT test portion shows it fairly well but all is lost went sent as an email.

While HTML might be nice, I’d be happy with just basic formatting options to break the clump of text into readable form.

You mention an option of sending it as text or html but I don’t see that option in the Send Email node. How do I instruct it to make such a choice?

Once I get that far I can test more to help iron out any potential bugs.

Hi there @Les_Henderson, all you need to do is select the Gmail step you added and scroll down in the right side bar, below the Reply to input.

Thanks. I see that both text and html have content boxes on the right side.

I just can’t figure out how I can feed the AI response from the previous step into either box and get it to show markdown or html or any kind of formatting afterwards.

What determines whether the email is going to be text or html when you have data boxes for both?

I don’t want to have to input edited text into the html box when I assume that I just need the link from the prior step in order to keep it fully automated.

Shared with Zight
Shared with Zight

Shared with Zight

I hope we can solve this problem. Huge releief on a ton og our customer support modules if this gets resolved.

Hi there @Chris_Tucker and @Les_Henderson

Chris did you try to use the body (HTML) input? and Les the output of your OpenAI step is not html, please ask it to do so, it is using what is called CommmonMark.

You can convert markdown to HTML using the text helper piece, and the markdown to html action, then feed the output to the send email action


Actually @MoShizzle’s suggestion is even better :smile:

That tip got me much further along. Thanks a bunch!
Shared with Zight

1 Like