You need to sign in to do that
Don't have an account?

Add a receipeint to a VisualForce Email Template?
Hi
I am trying to write a trigger to allow me to pass into an email template so that a particular recipient gets this email everytime it is used. So far I have gotten thus far:
I am getting an error on line 3 though stating that variable unknown:toaddressess
Can anyone see what I am doing wrong and indeed if this is the right way to go about resolving my over all requirement dilemma?
Thanks
Sonya
I am trying to write a trigger to allow me to pass into an email template so that a particular recipient gets this email everytime it is used. So far I have gotten thus far:
trigger SingleEmail on Opportunity (before insert) { Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage(); toAddresses = new String[] {'Joeblogg@abc123'}; email.setToAddresses(toAddresses); EmailTemplate template = new EmailTemplate(); template = [select Id from EmailTemplate where Name = 'P1_Incident_Update_Template_1']; mail.setTemplateID(template.Id); }
I am getting an error on line 3 though stating that variable unknown:toaddressess
Can anyone see what I am doing wrong and indeed if this is the right way to go about resolving my over all requirement dilemma?
Thanks
Sonya
Try by using a valid Email Address At line 3.
You did not define the variable.
Use "String[] toAddresses = new String[] {'Joeblogg@abc123.com'};"
at Line 3
You can also try the below one.