0

Hi SalesForce community,

I've some difficulties to create a footer/letterhead for an Visual Force email template. I know you can't create a letterhead for an Visual force email template but is it possible to bypass it, or do you know another solution?

Current situation: I've multiple email templates, html email templates but also multiple Visual Force email templates. I'm searching for a solution to create 1 dynamic footer that can be used on every email template.

Thanks for helping me out!

  • why not use a custom component c:MyFooter and add to every VF email template? Yes, a duplicate of footer used in letterheads but unlikely to change often – cropredy Aug 10 '20 at 18:06
  • @cropredy Thanks, you're my hero! – QuestionAsker123 Aug 11 '20 at 11:56
0

You are correct in that VF Email Templates can not use letterheads (this is a feature of HTML email templates)

But you can create a custom VF component and add a reference to it at the end of every VF Email template:

VF Email template:

<messaging:emailTemplate recipientType="Contact"
    relatedToType="Account"
    subject="Case report for Account: {!relatedTo.name}"
    language="{!recipient.language__c}"
    replyTo="support@acme.com">

    <messaging:htmlEmailBody>
        <html>
            <body>

            <p>Dear {!recipient.name},</p>
            ... other markup
            <c:MyFooter>  <!-- THE FOOTER COMPONENT --> 
            </body>
        </html>
    </messaging:htmlEmailBody>
</messaging:emailTemplate>

The Custom Component MyFooter

<apex:component>     
   <h3>Please visit us at www.acme.com</h3>   <!-- your markup -->
</apex:component>

These custom components can be as sophisticated as you want - they can include images that link to social media sites, be of different type faces or sizes etc. You can even pass contextual parameters from the parent email template in case some footers need variation.

VisualForce Custom Components reference

ADVISORY: VF Email Templates have rendering issues if the running user is Automated Process (such as in Platform Events). This may have been fixed by the time you are reading this. YMMV

Note: If you have a mix of HTML Letterhead and VF email templates, you will have to duplicate the "work" but at least the VF version is localized, easy to change and footers are unlikely to change often

  • Any idea how I can use the same footer as a personal signature for every person within my organisation? – QuestionAsker123 Aug 12 '20 at 8:56
  • Use the $User.xxx global merge field in the footer. – cropredy Aug 12 '20 at 14:04
  • I think my question was unclear, can I use the custom component 'MyFooter' for my personal signature ? If no, how can I bypass the standard 1333 characters from my personal signature? – QuestionAsker123 Aug 12 '20 at 14:38
  • If the personal signature is fetchable via soql, then it can be passed as a component attribute or fetched from the custom component's custom controller. – cropredy Aug 12 '20 at 14:44
  • Any other solution that is more on a "rookie level" (I just started to use Salesforce) – QuestionAsker123 Aug 12 '20 at 14:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.