specify an email template when sending emails in custom functions

specify an email template when sending emails in custom functions

Can we specify an email template when calling the sendmail function within a deluge custom function? I don't see anything about this in the API documentation but I thought I would ask what others have done. 

thanks,
Aaron