A lightning:formattedEmail component displays a read-only representation of an email address as a hyperlink using the mailto: URL scheme. Clicking on the email address opens the default mail application for the desktop or mobile device.
This example displays an email address with an email icon. The email address is displayed as the default label.
<aura:component> <lightning:formattedEmail value="hello@myemail.com" /> </aura:component>
Multiple email addresses are supported. The label "Send a group email" is displayed as a hyperlink in this example.
<aura:component> <lightning:formattedEmail value="hello@email1.com,hello@email2.com" label="Send a group email" /> </aura:component>
This example creates an email address with values for cc, subject, and email body. The label is displayed as a hyperlink.
<aura:component> <lightning:formattedEmail value="hello@myemail.com?cc=cc@myemail.com&subject=My%20subject &body=The%20email%20body" label="Send us your feedback" /> </aura:component>
Attribute Name | Attribute type | Description | Required? |
---|---|---|---|
body | Component[] | The body of the component. In markup, this is everything in the body of the tag. | |
value | String | The email address that's displayed if a label is not provided. | Yes |
label | String | The text label for the email. | |
onclick | Action | The action triggered when the email is clicked. |