---
schema_version: "1"
id: bd4c772c69a6fc87323b225ed9f2201df7e4ffac1224905c3766cb92f26d398c
title: EmailServicesFunction
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/api_meta/meta_emailservicesfunction.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_emailservicesfunction.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 0df3c79bfebd42cdf5a5097fb07829777cac9f5b8f84dc0f5bb07a434d787ea9
description: Represents an email service. This type extends the Metadata metadata type and inherits its fullName field.
---
# EmailServicesFunction

Represents an email service. This type extends the Metadata metadata type and inherits its fullName field.

## File Suffix and Directory Location

EmailServicesFunction components have the suffix .xml and are stored in the emailservices folder.

## Version

EmailServicesFunction components are available in API version 42.0 and later.

## Fields

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



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

              <th class="featureTableHeader  " id="d410756e88">Field Type</th>

              <th class="featureTableHeader  " id="d410756e91">Description</th>

            </tr>

          </thead>

          <tbody class="tbody">
            <tr>
              <td class="entry" headers="d410756e85" data-title="Field Name"><span class="keyword parmname" id="ApexClassId"><a name="ApexClassId"><!-- --></a>apexClass</span></td>

              <td class="entry" headers="d410756e88" data-title="Field Type">string</td>

              <td class="entry" headers="d410756e91" data-title="Description">Required. The name of the Apex class that the email service uses to process
                inbound messages.</td>

            </tr>

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

              <td class="entry" headers="d410756e88" data-title="Field Type">EmailServicesAttOptions (enumeration of type string)</td>

              <td class="entry" headers="d410756e91" data-title="Description">Required. Indicates the types of attachments the email service accepts. One of
                the following values:<ul class="ul bulletList">
                  <li class="li">
                    <samp class="codeph nolang">None</samp>—The email service accepts the
                    message but discards any attachment.
                  </li>

                  <li class="li">
                    <samp class="codeph nolang">NoContent</samp>—The attachment metadata
                    (filename, MIME type, and so on) is provided to the Apex class, but the body is
                    set to <samp class="codeph nolang">null</samp>.
                  </li>

                  <li class="li">
                    <samp class="codeph nolang">TextOnly</samp>—The email service only
                    accepts the following types of attachments:<ul class="ul bulletList">
                      <li class="li">Attachments with a Multipurpose Internet Mail Extension (MIME) type of
                        text.</li>

                      <li class="li">Attachments with a MIME type of application/octet-stream and a file name
                        that ends with either a .vcf or .vcs extension. These are saved as
                        text/x-vcard and text/calendar MIME types, respectively.</li>

                    </ul>
                  </li>

                  <li class="li">
                    <samp class="codeph nolang">BinaryOnly</samp>—The email service only
                    accepts binary attachments, such as image, audio, application, and video
                    files.
                  </li>

                  <li class="li">
                    <samp class="codeph nolang">All</samp>—The email service accepts any
                    type of attachment.
                  </li>

                </ul>
              </td>

            </tr>

            <tr>
              <td class="entry" headers="d410756e85" data-title="Field Name"><span class="keyword parmname" id="EsAuthenticationFailureAction"><a name="EsAuthenticationFailureAction"><!-- --></a>authenticationFailureAction</span></td>

              <td class="entry" headers="d410756e88" data-title="Field Type">EmailServicesErrorAction (enumeration of type string)</td>

              <td class="entry" headers="d410756e91" data-title="Description">Required. Indicates what the email service does with messages that fail or do
                not support any of the authentication protocols if the isAuthenticationRequired field is true.</td>

            </tr>

            <tr>
              <td class="entry" headers="d410756e85" data-title="Field Name"><span class="keyword parmname" id="EsAuthorizationFailureAction"><a name="EsAuthorizationFailureAction"><!-- --></a>authorizationFailureAction</span></td>

              <td class="entry" headers="d410756e88" data-title="Field Type">EmailServicesErrorAction (enumeration of type string)</td>

              <td class="entry" headers="d410756e91" data-title="Description">Required. Indicates what the email service does with messages received from
                senders who are not listed in the authorizedSenders field on either the
                email service or email service address.</td>

            </tr>

            <tr>
              <td class="entry" headers="d410756e85" data-title="Field Name"><span class="keyword parmname" id="EsAuthorizedSenders"><a name="EsAuthorizedSenders"><!-- --></a>authorizedSenders</span></td>

              <td class="entry" headers="d410756e88" data-title="Field Type">string</td>

              <td class="entry" headers="d410756e91" data-title="Description">Configures the email service to only accept messages from the email addresses
                or domains listed in this field. If the email service receives a message from an
                unlisted email address or domain, the email service performs the action specified in
                the authorizationFailureAction
                field. Leave this field blank if you want the email service to receive email from
                any email address. </td>

            </tr>

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

              <td class="entry" headers="d410756e88" data-title="Field Type"><a class="xref" href="#EmailServicesAddress_descr">EmailServicesAddress</a></td>

              <td class="entry" headers="d410756e91" data-title="Description">A list of EmailServiceAddress records.</td>

            </tr>

            <tr>
              <td class="entry" headers="d410756e85" data-title="Field Name"><span class="keyword parmname" id="ErrorRoutingAddress"><a name="ErrorRoutingAddress"><!-- --></a>errorRoutingAddress</span></td>

              <td class="entry" headers="d410756e88" data-title="Field Type">email</td>

              <td class="entry" headers="d410756e91" data-title="Description">The destination email address for error notification email messages when
                isErrorRoutingEnabled<samp class="codeph nolang"> is true</samp>.</td>

            </tr>

            <tr>
              <td class="entry" headers="d410756e85" data-title="Field Name"><span class="keyword parmname" id="EsFunctionInactiveAction"><a name="EsFunctionInactiveAction"><!-- --></a>functionInactiveAction</span></td>

              <td class="entry" headers="d410756e88" data-title="Field Type">EmailServicesErrorAction (enumeration of type string)</td>

              <td class="entry" headers="d410756e91" data-title="Description">Required. Indicates what the email service does with messages it receives when
                the email service itself is inactive. <div class="p">One of the following values:<ul class="ul bulletList">
                    <li class="li">
                      <samp class="codeph nolang">UseSystemDefault</samp>—The system default is
                      used.
                    </li>

                    <li class="li" id="EsBounceMessage">
                      <a name="EsBounceMessage"><!-- --></a><samp class="codeph nolang">Bounce</samp>—The email
                      service returns the message to the sender with a notification that explains
                      why the message was rejected.
                    </li>

                    <li class="li" id="EsDiscardMessage">
                      <a name="EsDiscardMessage"><!-- --></a><samp class="codeph nolang">Discard</samp>—The email
                      service deletes the message without notifying the sender.
                    </li>

                    <li class="li" id="EsRequeueMessage">
                      <a name="EsRequeueMessage"><!-- --></a><samp class="codeph nolang">Requeue</samp>—The email
                      service queues the message for processing in the next 24 hours. If the message
                      is not processed within 24 hours, the email service returns the message to the
                      sender with a notification that explains why the message was rejected.
                    </li>

                  </ul>
                </div>
              </td>

            </tr>

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

              <td class="entry" headers="d410756e88" data-title="Field Type">string</td>

              <td class="entry" headers="d410756e91" data-title="Description">Required. The name of the email service in the API. This name can contain only
                underscores and alphanumeric characters and must be unique in your org. The value in
                this 64-character field must begin with a letter, not include spaces, not end with
                an underscore, and not contain two consecutive underscores.<div class="p">In managed packages,
                  this field prevents naming conflicts on package installations. This field is
                  automatically generated, but you can supply your own value if you create the
                  record using the API. With this field, a developer can change the object’s name in
                  a managed package and the changes are reflected in a subscriber’s organization.
                  <div class="box message info">
                    <div class="inner">
                      <div class="bd">
                        <div class="media">
                          <img class="img mtm" src="https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/images/icon_note.png" alt="Note">
                          <div class="mediaBd">
                            <h4 class="mbs">Note</h4>
                            <p>When creating large sets of data, always specify a unique
                              <span class="keyword parmname">functionName</span> for each record. If no
                              <span class="keyword parmname">functionName</span> is specified, performance may slow while
                              Salesforce generates one for each record.
                            </p>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </td>

            </tr>

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

              <td class="entry" headers="d410756e88" data-title="Field Type">boolean</td>

              <td class="entry" headers="d410756e91" data-title="Description">Indicates whether this object is active (<samp class="codeph nolang">true</samp>) or not (<samp class="codeph nolang">false</samp>).</td>

            </tr>

            <tr>
              <td class="entry" headers="d410756e85" data-title="Field Name"><span class="keyword parmname" id="EsIsAuthenticationRequired"><a name="EsIsAuthenticationRequired"><!-- --></a>isAuthenticationRequired</span></td>

              <td class="entry" headers="d410756e88" data-title="Field Type">boolean</td>

              <td class="entry" headers="d410756e91" data-title="Description">Configures the email service to verify the legitimacy of the sending server
                before processing a message. The email service uses the SPF, SenderId, and
                DomainKeys protocols to verify the sender's legitimacy: If the sending server passes
                at least one of these protocols and does not fail any, the email service accepts the
                email. If the server fails a protocol or does not support any of the protocols, the
                email service performs the action specified in the authenticationFailureAction
                field.</td>

            </tr>

            <tr>
              <td class="entry" headers="d410756e85" data-title="Field Name"><span class="keyword parmname" id="IsErrorRoutingEnabled"><a name="IsErrorRoutingEnabled"><!-- --></a>isErrorRoutingEnabled</span></td>

              <td class="entry" headers="d410756e88" data-title="Field Type">boolean</td>

              <td class="entry" headers="d410756e91" data-title="Description">When incoming email messages can’t be processed, indicates whether error
                notification email messages are routed to a chosen address or to the
                senders.</td>

            </tr>

            <tr>
              <td class="entry" headers="d410756e85" data-title="Field Name"><span class="keyword parmname" id="IsTextAttachmentsAsBinary"><a name="IsTextAttachmentsAsBinary"><!-- --></a>isTextAttachmentsAsBinary</span></td>

              <td class="entry" headers="d410756e88" data-title="Field Type">boolean</td>

              <td class="entry" headers="d410756e91" data-title="Description">If <samp class="codeph nolang">true</samp>, text attachments are supplied to
                the Apex code as a <samp class="codeph nolang">Messaging.BinaryAttachment</samp>
                instead of as a <samp class="codeph nolang">Messaging.TextAttachment</samp>. This
                means that the body is supplied as an Apex Blob instead of as an Apex
                String.</td>

            </tr>

            <tr>
              <td class="entry" headers="d410756e85" data-title="Field Name"><span class="keyword parmname" id="EsIsTlsRequired"><a name="EsIsTlsRequired"><!-- --></a>isTlsRequired</span></td>

              <td class="entry" headers="d410756e88" data-title="Field Type">boolean</td>

              <td class="entry" headers="d410756e91" data-title="Description">Not currently in use. </td>

            </tr>

            <tr>
              <td class="entry" headers="d410756e85" data-title="Field Name"><span class="keyword parmname" id="EsOverLimitAction"><a name="EsOverLimitAction"><!-- --></a>overLimitAction</span></td>

              <td class="entry" headers="d410756e88" data-title="Field Type">EmailServicesErrorAction (enumeration of type string)</td>

              <td class="entry" headers="d410756e91" data-title="Description">Required. Indicates what the email service does with messages if the total
                number of messages processed by all email services combined has reached the daily
                limit for your organization.<div class="p" id="EsPossibleActions">
                  <a name="EsPossibleActions"><!-- --></a>One of the following values:<ul class="ul bulletList">
                    <li class="li">
                      <samp class="codeph nolang">UseSystemDefault</samp>—The system
                      default is used.
                    </li>

                    <li class="li">
                      <samp class="codeph nolang">Bounce</samp>—The email service returns the
                      message to the sender with a notification that explains why the message was
                      rejected.
                    </li>

                    <li class="li">
                      <samp class="codeph nolang">Discard</samp>—The email service deletes the
                      message without notifying the sender.
                    </li>

                    <li class="li">
                      <samp class="codeph nolang">Requeue</samp>—The email service queues the
                      message for processing in the next 24 hours. If the message is not processed
                      within 24 hours, the email service returns the message to the sender with a
                      notification that explains why the message was rejected.
                    </li>

                  </ul>
                </div>
                <p class="p">The system calculates the limit by multiplying the number of user
                  licenses by 1,000.</p>
              </td>

            </tr>

          </tbody>

        </table>

## EmailServicesAddress

Each email service has one or more email addresses to which users can send messages for processing. An email service only processes messages it receives at one of its addresses.

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



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

              <th class="featureTableHeader  " id="d410756e443">Field Type</th>

              <th class="featureTableHeader  " id="d410756e446">Description</th>

            </tr>

          </thead>

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

              <td class="entry" headers="d410756e443" data-title="Field Type">string</td>

              <td class="entry" headers="d410756e446" data-title="Description">Configures the email service address to only accept messages from the email
                addresses or domains listed in this field. If the email service address receives a
                message from an unlisted email address or domain, the email service performs the
                action specified in the authorizationFailureAction field of its
                associated email service. Leave this field blank if you want the email service
                address to receive email from any email address. </td>

            </tr>

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

              <td class="entry" headers="d410756e443" data-title="Field Type">string</td>

              <td class="entry" headers="d410756e446" data-title="Description">Required. The name of the object in the API. This name can contain only
                underscores and alphanumeric characters and must be unique in your org. It must
                begin with a letter, not include spaces, not end with an underscore, and not contain
                two consecutive underscores. This 25-character field must be unique among other
                EmailServicesAddress records under the same EmailServiceFunction parent.<div class="p">In
                  managed packages, this field prevents naming conflicts on package installations.
                  This field is automatically generated, but you can supply your own value if you
                  create the record using the API. With this field, a developer can change the
                  object’s name in a managed package and the changes are reflected in a subscriber’s
                  organization.<div class="box message info">
                    <div class="inner">
                      <div class="bd">
                        <div class="media">
                          <img class="img mtm" src="https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/images/icon_note.png" alt="Note">
                          <div class="mediaBd">
                            <h4 class="mbs">Note</h4>
                            <p>When creating large sets of data, always specify a unique
                              <span class="keyword parmname">developerName</span> for each record. If no
                              <span class="keyword parmname">developerName</span> is specified, performance might be slow
                              while Salesforce generates one for each record.
                            </p>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </td>

            </tr>

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

              <td class="entry" headers="d410756e443" data-title="Field Type">boolean</td>

              <td class="entry" headers="d410756e446" data-title="Description">Indicates whether this object is active (<samp class="codeph nolang">true</samp>) or not (<samp class="codeph nolang">false</samp>).</td>

            </tr>

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

              <td class="entry" headers="d410756e443" data-title="Field Type">string</td>

              <td class="entry" headers="d410756e446" data-title="Description">Required. The local-part of the email service address, which is the string that
                comes before the @ symbol. For the local-part of a Salesforce email address, all
                alphanumeric characters are valid, plus the following special characters: <p class="p"><samp class="codeph nolang">! # $ % &amp; amp; ' * / = ? ^ _ + - ` { | } ~
                    ,</samp></p>
                The dot character (.) is also valid as long as it's not the first or
                last character. Email addresses aren’t case sensitive.</td>

            </tr>

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

              <td class="entry" headers="d410756e443" data-title="Field Type">string</td>

              <td class="entry" headers="d410756e446" data-title="Description">Required. The username of the user whose permissions the email service assumes
                when processing messages sent to this address.</td>

            </tr>

          </tbody>

        </table>

## Wildcard Support in the Manifest File

This metadata type doesn’t support the wildcard character \* (asterisk) in the package.xml manifest file. For information about using the manifest file, see [Deploying and Retrieving Metadata with the Zip File](https://developer.salesforce.com/docs/atlas.en-us.264.0.api_meta.meta/api_meta/file_based_zip_file.htm).