You need to sign in to do that
Don't have an account?
AlexMS
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)
@AuraEnabled
public static void serverEmail() {
QuickAction.QuickActionRequest req = new QuickAction.QuickActionRequest();
req.setQuickActionName('SendEmail');
OutgoingEmail email = new OutgoingEmail();
email.ToAddress = 'xxxx@yyyyy';
email.Subject = 'Does this work?';
req.record = email;
QuickAction.QuickActionResult res = QuickAction.performQuickAction(req);
}
(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)
@AuraEnabled
public static void serverEmail() {
QuickAction.QuickActionRequest req = new QuickAction.QuickActionRequest();
req.setQuickActionName('SendEmail');
OutgoingEmail email = new OutgoingEmail();
email.ToAddress = 'xxxx@yyyyy';
email.Subject = 'Does this work?';
req.record = email;
QuickAction.QuickActionResult res = QuickAction.performQuickAction(req);
}
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:
1. http://sfdcmonkey.com/2017/01/03/send-email-lightning-component/
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.
2. https://naveendhanaraj.wordpress.com/2018/05/28/email-lightning-component-to-send-and-receive-email-for-standard-and-custom-objects/
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,
Raj