Newer Version Available
generateThreadingMessageId(caseId)
Returns an RFC 2822-compliant message identifier that contains
information used to match the email and its replies to a case.
Signature
public static String generateThreadingMessageId(Id caseId)
Parameters
- caseId
- Type: Id
- The case SObject ID to which replies to this email should be attached.
Return Value
Type: String
Usage
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.
Example
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.