Hi is it possible to use custom object as the recipientType in visualforce email template rather than the standard objects like User, Contact and Lead?

2 Answers 2


No, the recipientType cannot be a custom object. A recipient must be a "person", which is a User, Lead, Contact, or Person Account. You can specify a "relatedTo" that may be any any standard or custom object that allows activities.

  • Thanks, I have the Attendee custom object (which is a "person") that I want to use as the recipientType. I want to send an email every time a attendee signs up an event, so in the email body it will need to have related list from the attendee as well. Thanks. Aug 3, 2017 at 18:57
  • @JohnnySitu You can't define a custom "person" type. Call it a limitation of the platform. You'll need to use a design that leverages either leads or contacts. You can still use the attendee object to link a contact or lead to an event, but you'll need to rethink your current design.
    – sfdcfox
    Aug 3, 2017 at 19:52

Yes, If you are using custom controller and custom method to send email then you can use the custom object as the recipientType.

I have used custom object as a recipientType and it's working for me but yes i just want to be clear that i have used custom object using custom apex class and custom method,

Please see below piece of code that i used on my custom command button,

public PageReference SendPdfEmail()


        EmailTemplate template = [Select Id from EmailTemplate where Name='Test PDF'];
        String emailURL = '/_ui/core/email/author/EmailAuthor?p3_lkid=' + CustomObjId + '&template_id=' + template.Id + '&retURL=%2F' + CustomObjId + '&p2_lkid=' +CustomObj.Contact_Name__c;

        PageReference quotePage = new PageReference(emailURL);
        return quotePage;       

    }Catch(Exception e){
        return null;


Hope it helps you out !!

  • "p3" is the "related to" field, not the "recipient" field.
    – sfdcfox
    Aug 3, 2017 at 16:02

You must log in to answer this question.

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