Use the methods in the EmailMessages class to interact with emails and email threading.
EmailMessages
System