I need to get a string into my Visualforce email template. I have attempted to parse it over the URL as I thought it would be the easiest way but I'm not sure. I am using sendMail and sending the email with a controller so If I can call the string in the Visualforce template that would work too. Any advice?

Here is my string.

String ProteusStaffName = ApexPages.currentPage().getParameters().get('VFname');
  • 1
    I'm pretty sure the answer to this is "can't be done."
    – sfdcfox
    Commented Aug 26, 2014 at 2:50

2 Answers 2


Make your string variable public and define getter and setter:

public String ProteusStaffName {get; private set;}

then in your constructor or your init method set it's value

public YourClassConstructor()
    String ProteusStaffName = ApexPages.currentPage().getParameters().get('VFname');

And now it's easy to reference it on the visualforce page:

<apex:outputText value="{!ProteusStaffName}" />

Whether it would work in this context I don't know, but there is a direct way to get page parameters in Visualforce:

<apex:outputText value="{!$CurrentPage.Parameters.VFName}"/>

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .