I have created quick action button to open outlook app,and behind the scene I Am using LWC Headless Action to make it happen.

following is my complete lwc code.




import { api, LightningElement } from 'lwc';

export default class TestSendEmail extends LightningElement {
    @api invoke() {    
        var uri = "mailto:?subject=Test%20subject"+"&body="+encodeURIComponent("<table><tr><td>Test Html</td></tr></table>");
        console.log("show uri: ", uri);

        var a = document.createElement("a");
        a.href = uri;


<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
        <targetConfig targets="lightning__RecordAction">

And here's the button after added to page layout: enter image description here But when I click the button, html does not get rendered properly on outlook app like this following image enter image description here

The goal is only to open outlook app with correct rendered HTML. Hope anyone can help me fix this issue.

Thanks in advance

1 Answer 1


Unfortunately, you can't. RFC 2368 states:

The special hname "body" indicates that the associated hvalue is the

body of the message. The "body" hname should contain the content for

the first text/plain body part of the message. ...

(Emphasis added).

In other words, HTML just isn't allowed in the body, or anywhere else, in the mailto protocol.

It goes on to say:

... The mailto URL is

primarily intended for generation of short text messages that are

actually the content of automatic processing (such as "subscribe"

messages for mailing lists), not general MIME bodies.

Therefore, the rationale is that the mailto protocol is not suitable for composing complicated/encoded messages.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .