4

Does anyone know any workaround for using <apex:pageBlock> and it's child tags in a VF Email Template?

The error that I'm getting is :

Error: <messaging:emailTemplate> cannot contain <apex:pageBlock>.

There are lots of references to these type of tags in the template and it'll be good if there is an easy workaround so I don't spend 2 days modifying the whole template by hand :)

Much appreciated!

8

You can't use visualforce components that rely on salesforce css in email templates as those css files are not included with the email when it is sent out.

I would recommend replacing all the pageblock, pageblockbutton, and pageblocksection components with outputpanels as those will come closest to mimicing the layout of pageblocks.

Pageblocktables can be replaced with datatables.

  • 2
    Even if the CSS was included, you'd still have to be careful because they may not render as you'd expect depending on the level of support in the various email clients that might be in use by the recipients. – Peter Knolle Aug 21 '12 at 2:52
  • Yeah I guess outputPanels will come into play... Thanks! – Boris Bachovski Aug 21 '12 at 2:57
1

OutputPanels make divs. There's a lot of email clients out there that won't use divs correctly. You pretty much have to go old-school with email templates. Use with inline styles. CSS stylesheets are not well handled either.

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.