+ Start a Discussion

Set additionalTo or CC on a VF email template?

Is there a way to set the additional To or the CC fields when creating a Visualforce email template?  I can't find anything in the Developer's Guide or anywhere else.  We have two email fields on our Contact/Accounts (we use Person Accounts), so we need the emails to always go to both.


Previous to my learning VF, we used Conga merge and I was able to set this in the button parameters, so I am 99% sure it is possible...just not sure what the code is...


{!Recipient.Spouse_Email__c} gets me the correct field...now where to put it?


The email template itself would not include the AdditionalTo or CC recipients.  But you should be able to use a custom controller to define these.


In the Visualforce Developer's Guide (Spring '11), see page 142 in the 'Integrating Email with Visualforce section.  This shows an example of using a custom controller with a Visualforce email template.


In the Apex Code Developer's Guide (Spring '11), see page 330 for the Email object methods you would use to set the additional recipient fields.


I hope this helps!  Let me know how it goes - I'm working on a similar project also.