Find your content:

Search form

You are here

in Visualforce Email Template


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!

Attribution to: Boris Bachovski

Possible Suggestion/Solution #1

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.

Attribution to: Greg Grinberg

Possible Suggestion/Solution #2

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.

Attribution to: DaveS
This content is remixed from stackoverflow or stackexchange. Please visit

My Block Status

My Block Content