Home > Enterprise >  How to send html email with EmailJS
How to send html email with EmailJS

Time:11-20

I'm wanting to be able to send the following HTML code with EmailJS.

<div>
    <p>Please click below</p>
    <br/>
    <a href="http://website.com/path/to/link">Click me!</a>
</div>

It says on the EmailJS website that you can send HTML in emails, but there's no example given as to how you do that. All of the tutorials and examples online for EmailJS don't show how to send HTML in an email. If anyone knows how, I'd greatly appreciate the help!

It says at https://www.emailjs.com/docs/faq/can-I-send-html-emails/ that you can create HTML emails, but no example is given. Absolutely none of the tutorials and examples I've come across so far show how to put HTML into an email.

CodePudding user response:

In general, I know that it's not a safe idea to be sending HTML this way, which is why it's hard to find, but just for starters, you can use 3 brackets in your EmailJS template variable, like this, {{{ myHTML }}}. Then, just wrap your HTML tags and content in a string and send that variable on through. It will look odd, but EmailJS will interpret it correctly. I've done small things this way but I've never sent a link this way. It looks a little dangerous to me.

  • Related