How to pass rich text to SendGrid?

Hey Bubblers,

So I’m attempting to allow users to create rich text emails including not only bold and italic styles but also links using a Rich Text Editor input field.

I set up my 3-handlebar html variable in my SendGrid template called {{{body}}}.

I was able to successfully get the input text formatted to add line breaks (while still allowing the user to include quotation marks in their input) by using a series of four ‘Find and Replace’ operators. (See screenshots attached).

But now I’m stuck getting links to work.

The RTE produces them like this:
[url=http://zoomquilt.org]this cool website[/url]

But I need to get them to look like this:
<a href="https://zoomquilt.org/">this cool website</a>

Is there some way to achieve this using RegEx?

Thanks!







This is because RTE outputs the text as BBCode.
You can try a plugin to convert the BBCode into HTML. :wink:

Try Air BBCode to HTML Converter. Worked for me.

1 Like

Thanks, @rpetribu.

Hmm. Well, I gave it a try. Installed Air BBCode to HTML Converter. Passed the result of the converter workflow action to SendGrid and it wasn’t recognized at all. The email variable contained no content at all…

At this point, I’m still inclined to use a Find and Replace operator to somehow replace the ‘[url=’ characters with ‘<a href="’, etc. But my knowledge of RegEx is too limited. :unamused:

Any other ideas?

Regex might look scary, but there are a lot of tools online to help you perfect it. I’m betting you can figure out what you need to in a day or 2.

This topic was automatically closed after 70 days. New replies are no longer allowed.