When using auto-responders for email-to-case, the outbound emails are attached to the case. I'd like to perform the same action, when I am sending outbound emails via my own inbound email handler.
In my specific usage case (my custom inbound email handler), I am setting the 'targetObjectId' to a dummy contact (as a contact is required for emailing templates) and the 'WhatId' to the case id. There is no record of my email being sent out (though they are being sent, as can be seen when testing 'live').
I do have experience with creating an EmailMessage object and attaching it to a case (via parentId). I would think that an outbound message would 'magically' attach itself to a given object, but there is no method for specifying it as such.
Any help would be appreciated. Thanks!