Notes
// Get your Record ID. Here, we're using a dummy Case ID.
ID caseId = Id.valueOf('500xx000000bpkTAAQ');
// Get the formatted threading token.
String formattedToken = EmailMessages.getFormattedThreadingToken(caseId);
Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();
email.setToAddresses(new String[] {'test@example.com'});
email.setPlainTextBody('Test Email Notification text body' + '\n\n' + formattedToken);
email.setHtmlBody('Test Email Notification html body' + '<br><br>' + formattedToken);
email.setSubject('Test Notification ' + '[ ' + formattedToken + ' ]');
Messaging.sendEmail(new Messaging.SingleEmailMessage[]{email});