Modify a Visualforce Email Template for Guest Users

Protect access to your company’s data when you send emails that use Visualforce Classic email templates to guest users. These templates can be used with Process Builder, Workflow Builder, and Apex calls.

Required Editions

Available in: Salesforce Classic and Lightning Experience
Available in: Essentials, Enterprise, Performance, Unlimited, and Developer Editions
User Permissions Needed
To create or change Classic Visualforce email templates: Author Apex
To create or change Visualforce email templates: Customize Application
To create or change public email template folders: Manage Public Classic Email Templates

In Summer ‘20, Salesforce introduced a security policy that affects Visualforce email templates used to send emails to guest users in Experience Cloud sites.

Note
Note Classic Visualforce email templates must be edited in Salesforce Classic, but they can be used in Lightning Experience with Process Builder, Workflow Builder, and Apex calls.

Modify each Visualforce email template so that emails are sent correctly to all users, including guest users.

  1. Add the Author Apex user permission.
    1. From Setup, enter Profiles in the Quick Find box, then select Profiles.
    2. Edit an existing profile or create one.
    3. In the Administrative Permissions section, select Author Apex.
  2. Edit a Visualforce email template.
    1. In Setup, enter Classic in the Quick Find box, then select Classic Email Templates.
    2. Click the name of a Visualforce type template.
    3. Click Edit Template.
    4. Add the system context attribute to the emailTemplate tag:
      renderUsingSystemContextWithoutSharing="True"
      Warning
      Warning When renderUsingSystemContextWithoutSharing="True", the email template runs in system mode, which bypasses user permissions, field-level security, and organization-wide defaults. Be careful when using this setting so that you don't inadvertently expose sensitive data. Before using this setting, assess the impact of the guest security policy and, if necessary, update the Visualforce email templates instead.
    5. Click Save.
Example
Example
a Visualforce email template