I am working on setting up a scheduled apex class to send out emails to me every day. I have a visualforce template that takes a user and an opportunity as parameters that I would like to use. The scheduler works great and an email gets sent but the message body is blank. Here is my code that builds the email. Is there something I am doing wrong? I have tested the visualforce template by sending it to myself through the salesforce UI and it works fine.
public static void mail60(Opportunity op)
{
Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();
string [] toaddress= New string[]{'my email address'};
email.settemplateid(' template ID here'); //In the real code I have the correct IDs in place
email.setSubject( 'Blah - Maintenance and Support Renewal');
email.setToAddresses(toaddress);
email.setTargetObjectId(' contact ID here '); //In the real code I have the correct IDs in place
email.setWhatId(' opportunity ID here '); //In the real code I have the correct IDs in place
email.saveAsActivity = false;
Messaging.sendEmail(New Messaging.SingleEmailMessage[]{email});
}