Need Custom Function that will send an email template/notification to user

Need Custom Function that will send an email template/notification to user

We have a custom function that is triggered when a new ticket is created. Inside that custom function we have some conditions that determine next steps. in one of those conditions we want to trigger an email notification to be sent. How do we use Deluge to trigger a specific email notification/template to be sent out?