I would like to display the Community Url within a visualforce email template.

Standard templates use:


But I cannot find an equivalent field for visualforce email templates.

Here is a simplified version of the email template:

<messaging:emailTemplate subject="Forgot Password"
    recipientType="User" relatedToType="Community">
    <messaging:htmlemailbody >

                Dear {!recipient.Firstname },

            Your password has been reset for {!relatedTo.Name}. 

            Go to: {!$Network.NetworkUrlForUserEmails}



  1. What merge field can I use to create a link to the community?

I was working on a similar requirement some time back, where we had to send the reset password url for a community user.

If the Visualforce Email template you want to use, is defined under the Community Settings-->Adminstration, then using just {!$Network.NetworkUrlForUserEmails} should be good enough. If this doesn't helps you, then elaborate more on how exactly do you plan to use this template and what results do you see on using {!$Network.NetworkUrlForUserEmails}

<messaging:emailTemplate subject="forgotNew" 
<messaging:htmlEmailBody >


    <a href = "{!$Network.NetworkUrlForUserEmails}" > Hereeee </a>



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.