I have a custom list button on case that processes the selected case records and sends out an email using SingleEmailMessage. The email sends fine, but I was expecting the outbound email to be related to the case as an EmailMessage record. However, no EmailMessage record is created and related to the case.
I set the whatId to the case:
I can create the EmailMessage record in the apex code and set the parentId to the case, but I was hoping that there would be a way to attach the outbound email using SingleEmailMessage as an EmailMessage record on the case. Is that not possible?