generateThreadingMessageId(caseId)
Returns an RFC 2822-compliant message identifier that contains information used to match the email and its replies to a case.
public static String generateThreadingMessageId(Id caseId)
- caseId: Type: Id The case SObject ID to which replies to this email should be attached.
Type: String
Use the returned message identifier when sending case-related emails in Apex. The returned message identifier can be used in Message-ID or References headers. However, because Salesforce doesn’t let users specify the Message-ID, we set this identifier in the References header. When users reply to the sent email, replies should be attached to the specified case.
In this sample, we create an email with a message identifier so that the email and any responses can be associated with the related case.