function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Send email from Apex using inner class and template?

I have an Apex class called GeoNearestAgent which at the end of processing, has a list variable containing multiple rows of data I want to email.  At that point I create a SingleEmailMessage using a visual force email template and a component that references this apex class.  When I run it I get no data in the email.  Is the template controller reference creating another instance of the GeoNearestAgent class?   

<apex:component controller="GeoNearestAgent" access="global">
    <apex:dataTable value="{!Result}" var="pr" columns="3" border="1">
        <apex:column >
            <apex:facet name="header">Property</apex:facet>
        <apex:column >
            <apex:facet name="header">Agent</apex:facet>
        <apex:column >
            <apex:facet name="header">Distance</apex:facet>
It would be helpful if you would also post the code from your controller.