Ask a Question
Ask Question Login
Corporate Training
  1. Community
  2. Salesforce
  3. Question
Salesforce

How to put mailto html body with lwc?

Asked by David Edmunds Feb 28, 2023 1.0K views 1 answer
Share

About this question

I create a quick action button to open the outlook app. and behind the scene I Am using LWC Headless Action to make it happen. and the following code is my complete lwc


TestSendEmail.html


 
TestSendEmail.js
import { api, LightningElement } from 'lwc';
export default class TestSendEmail extends LightningElement {
    @api invoke() {    
        var uri = "mailto:?subject=Test subject"+"&body="+encodeURIComponent("
Test Html
");
        console.log("show uri: ", uri);
        var a = document.createElement("a");
        a.href = uri;
        a.click();        
    }
}
TestSendEmail.js-meta.xml
<?xml version="1.0" encoding="UTF-8"?>

    54.0
    true
    
        lightning__RecordAction
    
    
        
            Action
        
    

And here the button after added to page layout:

The goal is only to open an outlook app with correctly rendered HTML. Hope someone can help me fix this issue.

Your answer

1 Answer

More Salesforce discussions

Learn & Explore

Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.

Latest Salesforce Blogs

Guides, tips and career advice on Salesforce from JanBask experts.