function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Creating an email composer component programatically?

I have a Email button in our Lightning component which I want to open a Lightning email publisher in a popup or similar when it's clicked - does anyone know if this is possible? I've hunted about and the only thing I could find which sounded like it might work was to use QuickActions, but when I've tried to use this, it just immediately sends the email - it doesn't create a user interface for the user to modify the values.

(The Apex code below is what I'm calling from our Lightning component - but if there's a way to embed an email publisher in the Lightning code that would do too)

public static void serverEmail() {
QuickAction.QuickActionRequest req = new QuickAction.QuickActionRequest();
OutgoingEmail email = new OutgoingEmail();
email.ToAddress = 'xxxx@yyyyy';
email.Subject = 'Does this work?';
req.record = email;
QuickAction.QuickActionResult res = QuickAction.performQuickAction(req);

Maharajan CMaharajan C
Hi Alex,

You can simply use the custom component.

Build email compser using the custom component and then you can use that component in quick action or in record pages.

Reference Links:


If you want to auto populate the Email or any additional details automatically then use the Force:recordid to get the current page record id then in 
the do Init the related details using the server side call back functionality.


just use the Email Send button function from the above Link.

Can you please Let me know if it helps or not!!!

If it helps don't forget to mark this as a best answer!!!

Thanks for the info :) I think I did come across those articles - they're kind of what I ended up doing. I was more looking for a <lightning:emailComposer> style solution, but I've come up with a similar form of To:, Body: etc. but it doesn't have some of the niceties of the one that appears to be built in to Salesforce (like automatically searching your contacts when entering into the To: field).