---
schema_version: "1"
id: ca934cbea7e5e68dd63a00f33d4ee77c71c47b0343a7a39f8fb698bace3b0b34
title: EmailMessage
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/object_reference/sforce_api_objects_emailmessage.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_emailmessage.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 558ce7fdbf85b275d540d06e385a29f4e0add1fc1950ad6b3ac038a7ccfedc3a
description: Represents an email in Salesforce.
---
# EmailMessage

Represents an email in Salesforce.

## Supported Calls

create(), delete(), describeLayout(), describeSObjects(), getDeleted(), getUpdated(), query(), retrieve(), search(), undelete(), update(), upsert()

## Special Access Rules

EmailMessage is only available for orgs that use Email-to-Case or Enhanced Email, which is automatically enabled for most customers.

To use reply and forward functionality, FromAddress must specify an email address that exists in EmailMessageRelation, with a RelationType of FromAddress.

The Status field is mostly read-only. You can change the status only from New to Read.

The HtmlBody and RelatedToId fields are supported in Classic list views but not in Lightning list views. In related lists and search results in Lightning Experience, these fields either don’t appear, show blank values, or result in an error.

update() is supported when an email record is in Draft status, and IsPrivateDraft is false. It’s also supported if the email status is Draft, IsPrivateDraft is true, and CreatedBy is associated with the current user. When the email record isn’t in Draft status, the IsExternallyVisible field and custom fields only can be updated.

Set the Update Email Messages user permission for users, such as an Automated Case User, who run automated processes that modify email message-related records. With the Update Email Message permission set, users’ processes can modify EmailMessageRelation and ContentDocumentLink records that are related to an email message that isn’t in Draft status. Don’t set this user permission for other users.

Access to an email message depends on the associated object. The user who created the email is specified in CreatedById and always has access, unless that user is a guest user. Guest users have read access if the message is marked as IsExternallyVisible.

The object that’s used to determine access differs for Email-to-Case and Enhanced Email.

- Email-to-Case—When Email-to-Case is enabled and the email is Case-based (the ParentId field is Case), access depends on the user’s access to the related Case record. If the email message is a draft, only the user in the CreatedById field or users with the Modify All Data permission can access it.
- Enhanced Email—Access is activity-based. The ActivityId field specifies an associated Task record. You can control access to activity-based objects with the [Access Activities permission](https://help.salesforce.com/s/articleView?id=sales.activity_access_user_perm.htm&type=5&language=en_US "HTML (New Window)"). Users with the Modify All Data permission can also access the message.

When you use the API to insert EmailMessage records in bulk, the same access rules apply: access is based on cases in ParentId fields or by tasks in ActivityId fields. When inserting a single record, set the CreatedById field to the user performing the operation or leave it blank.

## Fields

<table class="featureTable sort_table" summary="">


          <thead class="thead sorted" align="left">
            <tr>
              <th class="featureTableHeader  " id="d679029e210">Field</th>

              <th class="featureTableHeader  " id="d679029e213">Details</th>

            </tr>

          </thead>

          <tbody class="tbody">
            <tr>
              <td class="entry" headers="d679029e210" data-title="Field"><span class="keyword parmname">ActivityId</span></td>

              <td class="entry" headers="d679029e213" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">reference</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Create, Filter, Group, Nillable, Sort</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">ID of the activity that is associated with the email.
                    Usually represents an open task that is created for the
                    case owner when a new unread email message is received.
                    <span class="keyword parmname">ActivityId</span> can only be
                    specified for emails on cases. It’s auto-created for
                    other entities.
                  </dd>



                  <dd class="dd">If an EmailMessage has a related task, and fields on the
                    email record are updated, we may delete the related task
                    and create a new related task.</dd>


                </dl>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d679029e210" data-title="Field"><span class="keyword parmname">AttachmentIds</span></td>

              <td class="entry" headers="d679029e213" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">string</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Create, Nillable, Update</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">A comma-separated list of email attachments. This is
                    used by the Send Email quick action when you use
                    Salesforce Classic email templates. Maximum length is
                    32, 768 characters.</dd>


                </dl>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d679029e210" data-title="Field"><span class="keyword parmname">AutomationType</span></td>

              <td class="entry" headers="d679029e213" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">picklist</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Create, Filter, Group, Nillable, Restricted picklist,
                    Sort</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">A picklist value that determines if an outgoing email
                    was manually created or AI-generated.</dd>

                  <dd class="dd">Possible values are: <ul class="ul bulletList">
                      <li class="li">
                        <samp class="codeph nolang">AiAssisted</samp>–Email is AI-generated, but
                        sent by human.
                      </li>

                      <li class="li">
                        <samp class="codeph nolang">AiAutomated</samp>–Email is generated and sent
                        by AI.
                      </li>

                      <li class="li">
                        <samp class="codeph nolang">Null</samp>–Email
                        is created and sent by human.
                      </li>

                    </ul>

                  </dd>


                </dl>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d679029e210" data-title="Field"><span class="keyword parmname">BccAddress</span></td>

              <td class="entry" headers="d679029e213" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">string</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Create, Filter, Nillable, Sort, Update</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">A string array of email addresses for recipients who
                    were sent a visually impaired carbon copy of the email
                    message. Include only email addresses that aren’t
                    associated with Contact, Lead, or User records in
                    Salesforce. If the recipient is a contact, lead, or
                    user, add their ID to the <span class="keyword parmname">BccIds</span>
                    field instead of adding their email address to the
                    <span class="keyword parmname">BccAddress</span> field. When adding
                    their ID, the email message is automatically associated
                    with the contact, lead, or user. For an Experience Cloud
                    site user who isn’t the sender of the email, this field
                    returns null.
                  </dd>

                  <dd class="dd">You can’t send emails unless there’s at least one
                    recipient.</dd>


                </dl>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d679029e210" data-title="Field"><span class="keyword parmname">BccIds</span></td>

              <td class="entry" headers="d679029e213" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">JunctionIdList</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Create, Update</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">
                    <span class="ph" id="EmailMessage_bcc_id_desc_ph"><a name="EmailMessage_bcc_id_desc_ph"><!-- --></a>A string array of
                      IDs for contacts, leads, and users who were sent a
                      visually impaired carbon copy of the email message.
                      Each ID is linked to an
                      <span class="keyword parmname">EmailMessageRelation</span> record,
                      which represents the relationship between an email
                      message and a Contact, Lead, or User record. For an
                      Experience Cloud site user who isn’t the sender of
                      the email, this list is empty.</span>
                    <p class="p">Adding a
                      <span class="keyword parmname">JunctionIdList</span> field name to
                      the <span class="keyword parmname">fieldsToNull</span> property
                      deletes all related junction records. This action
                      can’t be undone.
                    </p>
                  </dd>


                </dl>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d679029e210" data-title="Field">
                <span class="keyword parmname">CcAddress</span>
              </td>

              <td class="entry" headers="d679029e213" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">string</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Create, Filter, Nillable, Sort, Update</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">A string array of email addresses for recipients who
                    were sent a carbon copy of the email message. Include
                    only email addresses that aren’t associated with
                    Contact, Lead, or User records in Salesforce. If the
                    recipient is a contact, lead, or user, add their ID to
                    the <span class="keyword parmname">CcIds</span> field instead of adding
                    their email address to the
                    <span class="keyword parmname">CcAddress</span> field. Then the email
                    message is automatically associated with the contact,
                    lead, or user.
                  </dd>

                  <dd class="dd">You can’t send emails unless there’s at least one
                    recipient.</dd>


                </dl>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d679029e210" data-title="Field"><span class="keyword parmname">CcIds</span></td>

              <td class="entry" headers="d679029e213" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">JunctionIdList</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Create, Update</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">
                    <span class="ph" id="EmailMessage_cc_id_desc_ph"><a name="EmailMessage_cc_id_desc_ph"><!-- --></a>A string array of
                      IDs for contacts, leads, and users who were sent a
                      carbon copy of the email message. Each ID is linked
                      to an <span class="keyword parmname">EmailMessageRelation</span>
                      record, which represents the relationship between an
                      email message and a Contact, Lead, or User record.
                    </span>
                    <p class="p">Adding a <span class="keyword parmname">JunctionIdList</span>
                      field name to the <span class="keyword parmname">fieldsToNull</span>
                      property deletes all related junction records. This
                      action can’t be undone.</p>
                  </dd>


                </dl>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d679029e210" data-title="Field"><span class="keyword parmname">ClientThreadIdentifier</span></td>

              <td class="entry" headers="d679029e213" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">string</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Create, Filter, Nillable, Sort, Update</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">A value used by third-party email clients to identify
                    which thread an email belongs to. See <a class="xref" href="https://help.salesforce.com/s/articleView?id=service.support_email_to_case_threading.htm&amp;type=5&amp;language=en_US" target="_blank" title="html (New Window)">Email-to-Case
                      Threading</a> for more information.<p class="p">Available
                      in API versions 56.0 and later.</p>
                  </dd>


                </dl>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d679029e210" data-title="Field"><span class="keyword parmname" id="contentdocumentids"><a name="contentdocumentids"><!-- --></a>ContentDocumentIds</span></td>

              <td class="entry" headers="d679029e213" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">JunctionIdList</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Create, Update</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">
                    <span class="ph" id="contentdoc_desc"><a name="contentdoc_desc"><!-- --></a>A string array of IDs for
                      content documents such as files and attachments that
                      are associated with an email. Each ID is linked to a
                      <span class="keyword parmname">ContentDocumentLink</span> record,
                      which represents the relationship between an email
                      message and a content document record.</span>
                    <p class="p">Adding
                      a <span class="keyword parmname">JunctionIdList</span> field name to
                      the <span class="keyword parmname">fieldsToNull</span> property
                      deletes all related junction records. This action
                      can’t be undone.</p>
                  </dd>


                </dl>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d679029e210" data-title="Field"><span class="keyword parmname">Division</span></td>

              <td class="entry" headers="d679029e213" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">picklist</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Defaulted on create, Filter, Group, Restricted picklist,
                    Sort</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">A logical segment of your organization's data. For
                    example, if your company is organized into different
                    business units, you could create a division for each
                    business unit, such as “North America,” “Healthcare,” or
                    “Consulting.” Available only if the organization has the
                    Division permission enabled.</dd>


                </dl>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d679029e210" data-title="Field"><span class="keyword parmname">EmailRoutingAddressId</span></td>

              <td class="entry" headers="d679029e213" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">reference</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Create, Filter, Group, Nillable, Sort, Update</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">Stores the ID of the email routing address used to
                    create the email. This value is set when the email is
                    processed by Email-to-Case service. When this field is
                    set, EmailMessage.Incoming cannot be <samp class="codeph nolang">false</samp>.</dd>



                  <dt class="dt dlterm">Relationship Name</dt>

                  <dd class="dd">EmailRoutingAddress</dd>



                  <dt class="dt dlterm">Relationship Type</dt>

                  <dd class="dd">Lookup</dd>



                  <dt class="dt dlterm">Refers To</dt>

                  <dd class="dd">EmailRoutingAddress</dd>


                </dl>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d679029e210" data-title="Field"><span class="keyword parmname">EmailTemplateId</span></td>

              <td class="entry" headers="d679029e213" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">reference</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Create, Filter, Group, Nillable, Sort, Update</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">The email template, if any, that was chosen for the
                    email. This field is populated in Lightning Experience
                    only.</dd>

                  <dd class="dd">This is a relationship field.</dd>



                  <dt class="dt dlterm">Relationship Name</dt>

                  <dd class="dd">EmailTemplate</dd>



                  <dt class="dt dlterm">Relationship Type</dt>

                  <dd class="dd">Lookup</dd>



                  <dt class="dt dlterm">Refers To</dt>

                  <dd class="dd">EmailTemplate</dd>


                </dl>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d679029e210" data-title="Field"><span class="keyword parmname">FirstLinkClickedDate</span></td>

              <td class="entry" headers="d679029e213" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">dateTime</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Create, Filter, Nillable, Sort, Update</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">The timestamp for when a link in the email was first
                    clicked. </dd>

                  <dd class="dd">Available in API version 67.0 and later.</dd>


                </dl>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d679029e210" data-title="Field"><span class="keyword parmname">FirstOpenedDate</span></td>

              <td class="entry" headers="d679029e213" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">dateTime</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Create, Filter, Nillable, Sort, Update</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">The date the email was first opened.</dd>


                </dl>

                <p class="p">To see this field, enable email tracking in your org.</p>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d679029e210" data-title="Field"><span class="keyword parmname">FromAddress</span></td>

              <td class="entry" headers="d679029e213" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">email</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Create, Filter, Nillable, Sort, Update</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">The address that originated the email. When using this
                    field, specify an email address that exists in
                    EmailMessageRelation, with a
                    <span class="keyword parmname">RelationType</span> of
                    <samp class="ph systemoutput">FromAddress</samp>.
                  </dd>

                  <dd class="dd">EmailMessages in Draft status with
                    <span class="keyword parmname">IsPrivateDraft </span>set to <samp class="codeph nolang">true</samp> must use the
                    user's address, a verified org-wide email address, or a
                    verified Email-to-Case routing address in the
                    <span class="keyword parmname">FromAddress</span> field.
                  </dd>


                </dl>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d679029e210" data-title="Field"><span class="keyword parmname">FromId</span></td>

              <td class="entry" headers="d679029e213" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">reference</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Create, Filter, Group, Nillable, Sort</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">The contact, lead, or user who sent the email. Maximum
                    length is 18 characters.</dd>


                </dl>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d679029e210" data-title="Field"><span class="keyword parmname">FromName</span></td>

              <td class="entry" headers="d679029e213" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">string</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Create, Filter, Nillable, Sort, Update</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">The sender’s name. When using this field, specify an
                    email address that exists in EmailMessageRelation, with
                    a <span class="keyword parmname">RelationType</span> of
                    <samp class="ph systemoutput">FromAddress</samp>.
                  </dd>


                </dl>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d679029e210" data-title="Field"><span class="keyword parmname">HasAttachment</span></td>

              <td class="entry" headers="d679029e213" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">boolean</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Defaulted on create, Filter, Group, Sort</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">Indicates whether the email was sent with an attachment
                    (<samp class="codeph nolang">true</samp>) or not
                    (<samp class="codeph nolang">false</samp>).</dd>


                </dl>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d679029e210" data-title="Field"><span class="keyword parmname">HasReply</span></td>

              <td class="entry" headers="d679029e213" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">boolean</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Defaulted on create, Filter, Group, Sort</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">Indicates whether the email has a reply (<samp class="codeph nolang">true</samp>) or not (<samp class="codeph nolang">false</samp>). The default
                    value is <samp class="codeph nolang">false</samp>. </dd>

                  <dd class="dd">Available in API version 67.0 and later.</dd>


                </dl>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d679029e210" data-title="Field"><span class="keyword parmname">Headers</span></td>

              <td class="entry" headers="d679029e213" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">textarea</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Create, Nillable, Update</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">The Internet message headers of the incoming email. Used
                    for debugging and tracing purposes. Doesn’t apply to
                    outgoing emails.</dd>


                </dl>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d679029e210" data-title="Field"><span class="keyword parmname">HtmlBody</span></td>

              <td class="entry" headers="d679029e213" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">textarea</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Create, Nillable, Update</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">The body of the email in HTML format. </dd>

                  <dd class="dd">You can’t send emails unless at least one of these
                    fields has content. <ul class="ul bulletList">
                      <li class="li">Subject field</li>

                      <li class="li">HTML Body or Text Body field</li>

                    </ul>
                    As the sender, you can provide the content, or it
                    can be automatically inserted using predefined values.
                    An email template can also include the content for these
                    fields.</dd>


                </dl>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d679029e210" data-title="Field"><span class="keyword parmname">Incoming</span></td>

              <td class="entry" headers="d679029e213" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">boolean</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Create, Defaulted on create, Filter, Group, Sort</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">Indicates whether the email was received (<samp class="codeph nolang">true</samp>) or sent (<samp class="codeph nolang">false</samp>).</dd>


                </dl>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d679029e210" data-title="Field"><span class="keyword parmname">IsBounced</span></td>

              <td class="entry" headers="d679029e213" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">boolean</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Create, Defaulted on create, Filter, Group, Sort,
                    Update</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">Indicates whether the email bounced.<p class="p">This field is set
                      to True for bounced emails in orgs using Lightning
                      Threading. It’s not set to True for orgs using Ref
                      ID threading.</p>
                  </dd>


                </dl>

                <p class="p">To see this field, enable bounce management in your org.</p>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d679029e210" data-title="Field"><span class="keyword parmname">IsClientManaged</span></td>

              <td class="entry" headers="d679029e213" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">boolean</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Create, Defaulted on create, Filter, Group, Sort</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">If EmailMessage is created with
                    <span class="keyword parmname">IsClientManaged</span> set to <samp class="codeph nolang">true</samp>, users can modify
                    <span class="keyword parmname">EmailMessage.ContentDocumentIds</span>
                    to link file attachments even when the
                    <span class="keyword parmname">Status</span> of the EmailMessage
                    isn’t set to <samp class="codeph nolang">Draft</samp>.
                    When this field is set to <samp class="codeph nolang">true</samp> and Enhanced Email is enabled, a Task
                    record is created for the EmailMessage regardless of
                    Email-to-Case settings.
                  </dd>


                </dl>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d679029e210" data-title="Field"><span class="keyword parmname">IsDeleted</span></td>

              <td class="entry" headers="d679029e213" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">boolean</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Defaulted on create, Filter</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">Indicates whether the object has been moved to the
                    Recycle Bin (<samp class="codeph nolang">true</samp>)
                    or not (<samp class="codeph nolang">false</samp>).
                    Label is <strong class="ph b">Deleted</strong>.</dd>


                </dl>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d679029e210" data-title="Field"><span class="keyword parmname">IsExternallyVisible</span></td>

              <td class="entry" headers="d679029e213" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">boolean</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Defaulted on create, Filter, Group, Sort</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">If the Experience Cloud site case feed is enabled,
                    <span class="keyword parmname">IsExternallyVisible</span> controls
                    the external visibility of emails in sites. When
                    <span class="keyword parmname">IsExternallyVisible</span> is set to
                    <samp class="codeph nolang">true</samp>—its
                    default value—external users see the email message in
                    the case feed. <ul class="ul bulletList">
                      <li class="li">Emails remain visible in the Emails related list
                        whether or not this field is set to true. For
                        security reasons, we recommend that you remove
                        this related list from your case page layout for
                        external community users.</li>

                      <li class="li">Only emails with a value in the
                        <span class="keyword parmname">ParentId</span> field can be made
                        externally visible in sites.
                      </li>

                      <li class="li">This field can’t be updated if the email’s
                        <span class="keyword parmname">Status</span> is set to <samp class="codeph nolang">Draft</samp>.
                      </li>

                      <li class="li">
                        <p class="p">The <span class="keyword parmname">Enable Case Feeds in Experience
                            Cloud Sites</span> organization preference in
                          Setup makes case-related emails, comments, and
                          updates visible to site members.</p>
                        When this
                        preference is off,
                        <span class="keyword parmname">IsExternallyVisible</span> is True
                        by default for the EmailMessage. When this
                        preference is on,
                        <span class="keyword parmname">IsExternallyVisible</span> defaults
                        to True only if the case contact email is the
                        sender or the recipient of the
                        <span class="keyword parmname">EmailMessage.</span> Otherwise,
                        <span class="keyword parmname">IsExternallyVisible</span> defaults
                        to False.
                      </li>

                    </ul>
                  </dd>


                </dl>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d679029e210" data-title="Field"><span class="keyword parmname">IsLinkClicked</span></td>

              <td class="entry" headers="d679029e213" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">boolean</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Defaulted on create, Filter, Group, Sort</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">Indicates whether a link in the email has been clicked
                    (<samp class="codeph nolang">true</samp>) or not
                    (<samp class="codeph nolang">false</samp>). The
                    default value is <samp class="codeph nolang">false</samp>. Available in API version 67.0 and
                    later.</dd>


                </dl>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d679029e210" data-title="Field"><span class="keyword parmname">IsLinkTracked</span></td>

              <td class="entry" headers="d679029e213" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">boolean</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Create, Defaulted on create, Filter, Group, Sort,
                    Update</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">Indicates whether there are any URLs in the email that
                    can be tracked (<samp class="codeph nolang">true</samp>) or not (<samp class="codeph nolang">false</samp>). The default value is <samp class="codeph nolang">false</samp>. </dd>

                  <dd class="dd">Available in API version 67.0 and later.</dd>


                </dl>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d679029e210" data-title="Field"><span class="keyword parmname">IsOpened</span></td>

              <td class="entry" headers="d679029e213" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">boolean</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Defaulted on create, Filter, Group, Sort</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">Indicates whether the email has been opened.</dd>


                </dl>

                <p class="p">To see this field, enable email tracking in your org.</p>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d679029e210" data-title="Field"><span class="keyword parmname">IsPrivateDraft</span></td>

              <td class="entry" headers="d679029e213" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">boolean</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Create, Defaulted on create, Filter, Group, Sort</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">If <span class="keyword parmname">IsPrivateDraft</span> is set to
                    <span class="keyword parmname">true</span>, then only the<span class="keyword parmname">
                      CreatedById</span> user can view, update, and
                    send this email draft. If<span class="keyword parmname">
                      IsPrivateDraft</span> is set to
                    <span class="keyword parmname">false</span>, then any user with
                    permissions to work on the case can see these drafts.
                    After the email is sent, then this field is updated to
                    be <span class="keyword parmname">false</span>. Public drafts are loaded
                    and visible in Salesforce Classic while Private Drafts
                    are only used in Lightning Experience.
                  </dd>


                </dl>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d679029e210" data-title="Field"><span class="keyword parmname">IsTracked</span></td>

              <td class="entry" headers="d679029e213" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">boolean</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Create, Defaulted on create, Filter, Group, Sort,
                    Update</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">Indicates whether the email is being tracked.</dd>


                </dl>

                <p class="p">To see this field, enable email tracking in your org.</p>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d679029e210" data-title="Field"><span class="keyword parmname">LastLinkClickedDate</span></td>

              <td class="entry" headers="d679029e213" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">dateTime</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Create, Filter, Nillable, Sort, Update</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">The timestamp for when a link in the email was last
                    clicked. </dd>

                  <dd class="dd">Available in API version 67.0 and later.</dd>


                </dl>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d679029e210" data-title="Field"><span class="keyword parmname">LastOpenedDate</span></td>

              <td class="entry" headers="d679029e213" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">dateTime</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Create, Filter, Nillable, Sort, Update</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">The date the email was last opened.</dd>


                </dl>

                <p class="p">To see this field, enable email tracking in your org.</p>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d679029e210" data-title="Field"><span class="keyword parmname">MessageDate</span></td>

              <td class="entry" headers="d679029e213" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">dateTime</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Create, Filter, Nillable, Sort, Update</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">The date the email was created. </dd>

                  <dd class="dd">For inbound emails, Email-to-Case sets this field using
                    the Date header. The Date header is set by the email
                    client and is subject to the sender's time
                    preferences.</dd>


                </dl>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d679029e210" data-title="Field"><span class="keyword parmname">MessageIdentifier</span></td>

              <td class="entry" headers="d679029e213" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">string</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Create, Filter, Group, idLookup, Nillable, Sort,
                    Update</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">The ID of the email message.</dd>


                </dl>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d679029e210" data-title="Field"><span class="keyword parmname">Name</span></td>

              <td class="entry" headers="d679029e213" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">string</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Filter, Group, idLookup, Sort</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">A name for the email message that's derived from the
                    first 255 characters of the Subject field. If the
                    Subject field is empty, a localized string of <samp class="codeph nolang">[No Subject]</samp> is used.
                    This field is read-only and can’t be created or updated.
                    Available in API versions 56.0 and later.</dd>


                </dl>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d679029e210" data-title="Field"><span class="keyword parmname">ParentId</span></td>

              <td class="entry" headers="d679029e213" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">reference</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Create, Filter, Group, Nillable, Sort</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">ID of the case that’s associated with the email.</dd>

                  <dd class="dd">This is a relationship field.</dd>



                  <dt class="dt dlterm">Relationship Name</dt>

                  <dd class="dd">Parent</dd>



                  <dt class="dt dlterm">Relationship Type</dt>

                  <dd class="dd">Lookup</dd>



                  <dt class="dt dlterm">Refers To</dt>

                  <dd class="dd">Case</dd>


                </dl>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d679029e210" data-title="Field"><span class="keyword parmname">RelatedToId</span></td>

              <td class="entry" headers="d679029e213" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">reference</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Create, Filter, Group, Nillable, Sort, Update</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">
                    <p class="p">The <span class="keyword parmname">RelatedToId</span> represents
                      nonhuman objects such as accounts, opportunities,
                      campaigns, cases, or custom objects. RelatedToIds
                      are polymorphic. Polymorphic means a RelatedToId is
                      equivalent to the ID of a related object.</p>

                    <p class="p">You must have access to at least one entity listed
                      under Refers To to access RelatedToId.</p>

                    <p class="p">You can update <span class="keyword parmname">RelatedToId</span> when
                      <span class="keyword parmname">IsClientManaged</span> is set to
                      <span class="keyword parmname">true</span>.
                    </p>

                    <p class="p"><span class="keyword parmname">RelatedtoId</span> and
                      <span class="keyword parmname">ParentId</span> should have the same
                      value when <span class="keyword parmname">ParentId</span> is set. You
                      might see unexpected results otherwise.
                    </p>

                  </dd>

                  <dd class="dd">This is a polymorphic relationship field.</dd>



                  <dt class="dt dlterm">Relationship Name</dt>

                  <dd class="dd">RelatedTo</dd>



                  <dt class="dt dlterm">Relationship Type</dt>

                  <dd class="dd">Lookup</dd>



                  <dt class="dt dlterm">Refers To</dt>

                  <dd class="dd">Account, Accreditation, AssessmentIndicatorDefinition,
                    AssessmentTask, AssessmentTaskContentDocument,
                    AssessmentTaskDefinition, AssessmentTaskOrder, Asset,
                    AssetRelationship, AssignedResource, Award,
                    BoardCertification, BusinessLicense, BusinessMilestone,
                    BusinessProfile, Campaign, CareBarrier,
                    CareBarrierDeterminant, CareBarrierType,
                    CareDeterminant, CareDeterminantType, CareDiagnosis,
                    CareInterventionType, CareMetricTarget, CareObservation,
                    CareObservationComponent, CarePgmProvHealthcareProvider,
                    CarePreauth, CarePreauthItem, CareProgram,
                    CareProgramCampaign, CareProgramEligibilityRule,
                    CareProgramEnrollee, CareProgramEnrolleeProduct,
                    CareProgramEnrollmentCard, CareProgramGoal,
                    CareProgramProduct, CareProgramProvider,
                    CareProgramTeamMember, CareProviderAdverseAction,
                    CareProviderFacilitySpecialty,
                    CareProviderSearchableField, CareRegisteredDevice,
                    CareRequest, CareRequestDrug, CareRequestExtension,
                    CareRequestItem, CareSpecialty, CareSpecialtyTaxonomy,
                    CareTaxonomy, Case, CommSubscriptionConsent,
                    ContactEncounter, ContactEncounterParticipant,
                    ContactRequest, Contract, CoverageBenefit,
                    CoverageBenefitItem, CreditMemo, DelegatedAccount,
                    DocumentChecklistItem, EnrollmentEligibilityCriteria,
                    HealthcareFacility, HealthcareFacilityNetwork,
                    HealthcarePayerNetwork, HealthcarePractitionerFacility,
                    HealthcareProvider, HealthcareProviderNpi,
                    HealthcareProviderSpecialty, HealthcareProviderTaxonomy,
                    IdentityDocument, Image, IndividualApplication, Invoice,
                    ListEmail, Location, MemberPlan, Opportunity, Order,
                    OtherComponentTask, PartyConsent, PersonLifeEvent,
                    PlanBenefit, PlanBenefitItem, ProcessException,
                    Product2, ProductItem, ProductRequest,
                    ProductRequestLineItem, ProductTransfer, PurchaserPlan,
                    ReceivedDocument, ResourceAbsence, ReturnOrder,
                    ReturnOrderLineItem, ServiceAppointment,
                    ServiceResource, Shift, Shipment, ShipmentItem,
                    Solution, Visit, VisitedParty, VolunteerProject,
                    WorkOrder, WorkOrderLineItem</dd>


                </dl>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d679029e210" data-title="Field"><span class="keyword parmname">ReplyToEmailMessageId</span></td>

              <td class="entry" headers="d679029e213" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">reference</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Create, Filter, Group, Nillable, Sort</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">ID of the inbound or outbound email message the current
                    email message is a reply to. It’s not possible to reply
                    to a message whose <span class="keyword parmname">Status</span> is
                    <samp class="codeph nolang">Draft</samp>.
                  </dd>

                  <dd class="dd">This is a relationship field.</dd>

                  <dd class="dd">This is only set for Case related Email replies at
                    setup.</dd>



                  <dt class="dt dlterm">Relationship Name</dt>

                  <dd class="dd">ReplyToEmailMessage</dd>



                  <dt class="dt dlterm">Relationship Type</dt>

                  <dd class="dd">Lookup</dd>



                  <dt class="dt dlterm">Refers To</dt>

                  <dd class="dd">EmailMessage</dd>


                </dl>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d679029e210" data-title="Field"><span class="keyword parmname">Source</span></td>

              <td class="entry" headers="d679029e213" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">picklist</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Create, Filter, Group, Nillable, Restricted picklist,
                    Sort</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">When Sync Email as Salesforce Activity is enabled, this
                    value reflects from where the email was captured
                    automatically. Available in API version 64.0 and
                    later.</dd>

                  <dd class="dd">Possible values are: <ul class="ul bulletList">
                      <li class="li">
                        <samp class="codeph nolang">Einstein Activity
                          Capture</samp>–Captured as an entire email
                        message by Einstein Activity Capture.
                      </li>

                      <li class="li">
                        <samp class="codeph nolang">Einstein Activity
                          Capture Limited</samp>–Captured as a header-only
                        email by Einstein Activity Capture. The sender,
                        recipients, date, and time of the message were
                        captured, not the subject or body.
                      </li>

                      <li class="li">
                        <samp class="codeph nolang">Email Integration
                          App Manual</samp>-Captured to track the email
                        message records created or edited from the
                        mailapp.
                      </li>

                      <li class="li">
                        <samp class="codeph nolang">Migrated Captured
                          Email</samp>-An email that was captured in
                        Einstein Activity Capture and migrated to an
                        updated version of Einstein Activity Capture in
                        which Sync Email as Activity is turned on.
                        Available in API version 65.0 and later.
                      </li>

                      <li class="li">
                        <samp class="codeph nolang">Migrated Captured
                          Email Header Only</samp>-An email that was
                        captured in Einstein Activity Capture and migrated
                        as header-only data to an updated version of
                        Einstein Activity Capture in which Sync Email as
                        Activity is turned on. Available in API version
                        65.0 and later.
                      </li>

                    </ul>

                  </dd>


                </dl>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d679029e210" data-title="Field"><span class="keyword parmname">Status</span></td>

              <td class="entry" headers="d679029e213" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">picklist</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Create, Filter, Group, Restricted picklist, Sort,
                    Update</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">The status of the email. <p class="p">The
                      <span class="keyword parmname">Status</span> field is mostly
                      read-only. You can change the status only from
                      <var class="keyword varname">New</var> to
                      <var class="keyword varname">Read</var>.
                    </p>
                    Possible values are:<ul class="ul bulletList">
                      <li class="li">
                        <samp class="codeph nolang">0</samp>
                        (New)
                      </li>

                      <li class="li">
                        <samp class="codeph nolang">1</samp>
                        (Read)
                      </li>

                      <li class="li">
                        <samp class="codeph nolang">2</samp>
                        (Replied)
                      </li>

                      <li class="li">
                        <samp class="codeph nolang">3</samp>
                        (Sent)
                      </li>

                      <li class="li">
                        <samp class="codeph nolang">4</samp>
                        (Forwarded)
                      </li>

                      <li class="li">
                        <samp class="codeph nolang">5</samp>
                        (Draft)
                      </li>

                    </ul>
                  </dd>

                  <dd class="dd">For emails not sent as part of a case, only the status
                    <samp class="codeph nolang">3</samp> (Sent) is
                    valid.
                  </dd>


                </dl>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d679029e210" data-title="Field"><span class="keyword parmname">Subject</span></td>

              <td class="entry" headers="d679029e213" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">string</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Create, Filter, Nillable, Sort, Update</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">The subject line of the email. </dd>

                  <dd class="dd">You can’t send emails unless at least one of these
                    fields has content. <ul class="ul bulletList">
                      <li class="li">Subject field</li>

                      <li class="li">HTML Body or Text Body field</li>

                    </ul>
                    As the sender, you can provide the content, or it
                    can be automatically inserted using predefined values.
                    An email template can also include the content for these
                    fields.
                  </dd>


                </dl>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d679029e210" data-title="Field"><span class="keyword parmname">TextBody</span></td>

              <td class="entry" headers="d679029e213" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">textarea</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Create, Nillable, Update</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">The body of the email, in plain text format. If
                    <span class="keyword parmname">TextBody</span> isn’t set, then it’s
                    extracted from <span class="keyword parmname">HtmlBody</span>.
                  </dd>

                  <dd class="dd">You can’t send emails unless at least one of these
                    fields has content. <ul class="ul bulletList">
                      <li class="li">Subject field</li>

                      <li class="li">HTML Body or Text Body field</li>

                    </ul>
                    As the sender, you can provide the content, or it
                    can be automatically inserted using predefined values.
                    An email template can also include the content for these
                    fields
                  </dd>


                </dl>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d679029e210" data-title="Field"><span class="keyword parmname">ThreadIdentifier</span></td>

              <td class="entry" headers="d679029e213" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">string</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Create, Filter, Group, idLookup, Nillable, Sort,
                    Update</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">The ID of the email thread the email message belongs to.
                    This field is used by features that sync emails directly
                    from an inbox into Salesforce. This field is not used by
                    On-Demand Email-to-Case.</dd>


                </dl>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d679029e210" data-title="Field"><span class="keyword parmname">ToAddress</span></td>

              <td class="entry" headers="d679029e213" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">string</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Create, Filter, Nillable, Sort, Update</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">A string array of email addresses for recipients who
                    were sent the email message. Include only email
                    addresses that aren’t associated with Contact, Lead, or
                    User records in Salesforce. If the recipient is a
                    contact, lead, or user, add their ID to the
                    <span class="keyword parmname">ToIds</span> field instead of adding
                    their email address to the
                    <span class="keyword parmname">ToAddress</span> field. Then the email
                    message is automatically associated with the contact,
                    lead, or user.
                  </dd>

                  <dd class="dd">You can’t send emails unless there’s at least one
                    recipient.</dd>


                </dl>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d679029e210" data-title="Field"><span class="keyword parmname">ToIds</span></td>

              <td class="entry" headers="d679029e213" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">JunctionIdList</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Create, Update</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">
                    <span class="ph" id="EmailMessage_to_id_desc_ph"><a name="EmailMessage_to_id_desc_ph"><!-- --></a>A string array of
                      IDs for contacts, leads, and users who were sent a
                      carbon copy of the email message. Each ID is linked
                      to an <span class="keyword parmname">EmailMessageRelation</span>
                      record, which represents the relationship between an
                      email message and a Contact, Lead, or User record.
                    </span>
                    <p class="p">Adding a <span class="keyword parmname">JunctionIdList</span>
                      field name to the <span class="keyword parmname">fieldsToNull</span>
                      property deletes all related junction records. This
                      action can’t be undone.</p>
                  </dd>


                </dl>

              </td>

            </tr>

            <tr>
              <td class="entry" headers="d679029e210" data-title="Field"><span class="keyword parmname">ValidatedFromAddress</span></td>

              <td class="entry" headers="d679029e213" data-title="Details">
                <dl class="dl detailList">

                  <dt class="dt dlterm">Type</dt>

                  <dd class="dd">picklist</dd>



                  <dt class="dt dlterm">Properties</dt>

                  <dd class="dd">Create, Filter, Group, Nillable, Restricted picklist,
                    Sort, Update</dd>



                  <dt class="dt dlterm">Description</dt>

                  <dd class="dd">
                    <p class="p">A picklist value with either the sender's address,
                      org-wide email addresses, or Email-to-Case routing
                      address. The email address must be verified. If the
                      sender’s email address is used, the sender must be
                      the current user.</p>

                    <p class="p"><span class="keyword parmname">ValidatedFromAddress</span> isn’t
                      suitable for use in Group By or Sort By statements.
                      Use <span class="keyword parmname">FromAddress</span> instead.</p>

                  </dd>


                </dl>

              </td>

            </tr>

          </tbody>

        </table>

## Usage

EmailMessage is limited to 50 custom fields.

If your org uses Email-to-Case, a case is created when an email is sent to one of your company’s addresses. The email, which is related to the case by the ParentID field, is stored as an EmailMessage record. When users view the email, they see the EmailMessage record.

If your org uses Enhanced Email, each email is stored as an EmailMessage record and a Task record. When users view an email, they see the EmailMessage record.

![Note](https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/images/icon_note.png)

#### Note

In an org with Email-to-Case enabled, an inbound (Incoming = true) email with case as the parent record won’t create a task automatically. This functionality respects the Create Task from Email setting for each Email-to-Case routing address.

If you would like to change the recipients or contents of an outbound email, don’t use automation tools, like Flows or Apex triggers, to update EmailMessage records. Unless they are for a draft, updates to EmailMessage records will not be reflected in the actual sent email. To update an email’s data before it’s sent, use Quick Action predefined values or a [QuickActionDefaultsHandler](https://developer.salesforce.com/docs/atlas.en-us.264.0.apexref.meta/apexref/apex_interface_QuickAction_QuickActionDefaultsHandler.htm).

When a Flow creates an EmailMessage with set values in the audit fields (like CreatedBy and CreatedDate), any FeedItem automatically created for that EmailMessage will not share the same audit field values.

## Sample Code—Apex

This sample logs email activity in Salesforce.

// if EnhancedEmail Perm is not enabled, continue logging the email as a task

// if EnhancedEmail Perm is enabled, create an EmailMessage object
EmailMessage emailMessage = new EmailMessage();
emailMessage.status = '3'; // email was sent
emailMessage.relatedToId = '006B0000003weZGIAY'; // related to record e.g. an opportunity
emailMessage.fromAddress = 'sender@example.com'; // from address
emailMessage.fromName = 'Dan Perkins'; // from name
emailMessage.subject = 'This is the Subject!'; // email subject
emailMessage.htmlBody = '<html><body><b>Hello</b></body></html>'; // email body
// Contact, Lead or User Ids of recipients
String\[\] toIds = new String\[\]{'003B000000AxcEjIAJ'}; 
emailMessage.toIds = toIds;
// additional recipients who don’t have a corresponding contact, lead or user id in the Salesforce org (optional)
emailMessage.toAddress = 'emailnotinsalesforce@toexample.com, anotherone@toexample.com';
insert emailMessage; // insert

// Add Email Message Relation for id of the sender
EmailMessageRelation emr = new EmailMessageRelation();
emr.emailMessageId = emailMessage.id;
emr.relationId = '005B0000003qHvOIAU'; // user id of the sender
emr.relationType = 'FromAddress';
insert emr;

## Associated Objects

This object has the following associated objects. If the API version isn’t specified, they’re available in the same API versions as this object. Otherwise, they’re available in the specified API version and later.

[EmailMessageChangeEvent](https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_associated_objects_change_event.htm "A ChangeEvent object is available for each object that supports Change Data Capture. You can subscribe to a stream of change events using Change Data Capture to receive data tied to record changes in Salesforce. Changes include record creation, updates to an existing record, deletion of a record, and undeletion of a record. A change event isn’t a Salesforce object—it doesn’t support CRUD operations or queries. It’s included in the object reference so you can discover which Salesforce objects support change events.") (API version 48.0)

Change events are available for the object.

#### See Also

- [Case](https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_case.htm "Represents a case, which is a customer issue or problem.")
- [Overview of Salesforce Objects and Fields](https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_concepts.htm "Salesforce objects and fields are analogous to database tables and the table columns. Objects and fields structure data. For example, the central object in the Salesforce data model represents accounts—companies and organizations involved with your business, such as customers, partners, and competitors.")