I am having a little trouble sending an email to a lead using a template when an Event of type visit is created and again the day before the event. I can't use a workflow because ActivityDate is not available to be referenced. Also not sure how the lead's email will be determined when sending the email. I would like an example of workflow to do this. Or perhaps Is there a a good way to go about this? Maybe a trigger. But the setTargetId of Messaging.SingleEmailMessage does not seem to support event. Any suggestion on how I should approach this? Examples would be great.
Template
<messaging:emailTemplate subject="Hello" recipientType="Lead" relatedToType="Event">
<messaging:htmlEmailBody >
<p>This is a reminder about your visit on <strong>{!relatedTo.ActivityDate}</strong></p>
<p>Please use the details below as a reminder of your visit </p>
<p><strong>Location:</strong> {!relatedTo.Location} </p>
<p>Sincerely,</p>
<p>{!relatedTo.Owner.Name} </p>
</messaging:htmlEmailBody>
</messaging:emailTemplate>