The <apex:emailPublisher>
component allows you to embed the standard Salesforce email composer directly into a Visualforce page. It gives users the ability to send emails from within custom pages using Salesforce’s rich email editor.
Why Use <apex:emailPublisher>
?
- Allows users to send emails without leaving the Visualforce page.
- Offers Salesforce’s native email editor features, including templates, attachments, and merge fields.
- Enhances productivity by integrating communication tools directly in custom UIs.
Basic Syntax
xmlCopyEdit<apex:emailPublisher entityId="{!relatedRecordId}"/>
Key Attributes
Attribute | Description |
---|---|
entityId | (Required) The ID of the related record (e.g., Contact, Case, Opportunity) |
disabled | (Optional) If set to true, the component will be disabled |
rendered | (Optional) Controls whether the component is displayed |
Example: Email Publisher for a Case Record
xmlCopyEdit<apex:page standardController="Case">
<apex:emailPublisher entityId="{!Case.Id}"/>
</apex:page>
This will render the email publisher interface for the specific Case record.
Use Cases
- Customer Support Dashboards: Allow agents to send emails while managing cases.
- Sales Pages: Enable direct client communication from within opportunity views.
- Internal Communication: Embed email tools in any custom workflow page.
Note
- The component requires the Enhanced Email feature to be enabled.
- Make sure that email deliverability settings in Salesforce org are configured properly.