You do not create EmailMessage records by hand. They appear when Email-to-Case captures inbound mail and when agents reply from the Case feed. To make that happen, turn on Email-to-Case and connect a support address. These steps follow the Salesforce setup flow.
- Turn on Email-to-Case
In Setup, search for Email-to-Case, open it, and enable the feature. Confirm when prompted. This activates the engine that converts inbound mail into Cases and EmailMessage records.
- Connect a support email address
Open the routing address manager and add the address customers will write to, such as support@yourcompany.com. Choose your email provider, then verify the address by clicking the confirmation email Salesforce sends.
- Set case defaults
Decide which default values, such as Case Origin and Priority, get stamped on Cases created from this address. Clean defaults here save manual cleanup later and keep your reporting consistent.
- Enable the Email action in the Case feed
Confirm the Email quick action is on the Case feed layout so agents can reply. Each reply they send writes an outbound EmailMessage linked to the Case through ParentId.
The inbound address customers email. Each one can carry its own default Case field values and its own forwarding setup.
The header-plus-token matching that attaches replies to the right Case. Keep it on so customer answers thread cleanly instead of spawning duplicates.
A paid add-on for bounce handling, signature stripping, and very high inbound volume. Worth evaluating once daily email counts climb into the thousands.
The IsExternallyVisible flag on each message. Controls whether a customer sees a message in an Experience Cloud help center or portal.
- Broken threading is the top cause of duplicate Cases. If a customer or a relay strips the subject token or rewrites headers, replies cannot match and a second Case opens.
- Status is stored as a number, not text. In SOQL or Apex, filter sent mail with Status equals 3, not the word Sent, to avoid surprises.
- Records you create in Apex do not inherit the composer defaults. Set ParentId, the body fields, Incoming, and IsExternallyVisible explicitly or the message may render or route incorrectly.