We’re Heading to CNX ’25. Let's Meet in Chicago! Join HIC at Salesforce Connections'25 for conversations, collaboration, and co-creation.

A primer on the Process

For the uninitiated, the Email Service in Salesforce is an automated Process that strips content bodies, subtext, headers, and attachments from inbound emails for Object creation.

You could go about tieing each Email Service Process to Salesforce-created email addresses meant to receive messages for processing from users of a service.

Alternatively though, to give multiple users access to a service you could associate a single Salesforce email to an Email Service and write a class in Apex to execute differently for each user.

A common use case

As an example, you could write Apex Classes to identify users based-off of their email addresses and create Records accordingly.

Let’s talk Governor Limits

As is often the case with email capabilities, there’re Governor Limits to keep in mind. Here’s a list of them:

  • An email service only processes messages it receives at one of its addresses.
  • Salesforce limits the total number of messages for all email services combined for daily processing, including On-Demand Email-to-Case. Messages exceeding this limit are bounced, discarded, or queued for processing the next day, depending on how you configure the failure response settings for each Email Service.
  • Salesforce calculates the limit by multiplying the number of user licenses by 1,000 and caps out at 1,000,000. For example, if you have 10 licenses, your Org can process up to 10,000 email messages a day.
  • Email Service addresses created in your sandbox can’t be copied to your production Org.
  • For each Email Service, you can tell Salesforce to send error email messages to a specified address instead of the sender’s email address.
  • Email Services reject email messages and notify the sender of the email(comprised of combined body text, body HTML and attachments that extend approximately 10 MB depending on language and character set).
  • Now that you’re a bit more familiar, here is some syntax for you to look at. First of these – is the Email Service.

General syntax for Email Service class in Salesforce

Some more syntax

For our example, we start with the premise that each email’s subject and body contain no more than the words “Create Contact” and the Contact’s name(in that order). Then, in the likeness of an everyday enterprise scenario, we process subject lines to create new Contacts in Salesforce and extract Contact Names from the email body. Attachments come up under the Contact object in sales. In the following sections, you’ll find code implementations and test classes( 75% coverage) for the same.

Apex Class:-

Test Class:-

Defining Email Services with our Apex Class

After creating the above Apex Class, within your instance, go to

<Your Name> | Setup | Develop | Email Services.

Once there,

  • Click New Email Service to define a new Email Service.

Select the Apex Class we just created above, add the email address from where to accept the request and activate the Service as shown below:

After filling out the information, click Save and New Email Address

Next, click Save. This should throw up an email address as shown below.

Note: The domain name in the Email Address must qualify the one entered at Email Service in the first step. For instance, we’ve entered “gmail.com” in the first step, which means it will accept the email address only from gmail.com like the one in the email we just saw.

Finally, once the email address is generated by Salesforce, send the email to that address with the subject line “Create Contact” and a Contact Name as the email body to see if everything checks out.

Conclusion

The codebase here lets you extract data from emails for creating Contacts in your Salesforce Org that could be used to service Contacts from a business account in case of multiple users, especially for helpdesk operations or pushing updates and notifications. You could just as well extend this to build on stores for other objects. For any further assistance with Email feature sets or data extraction solutions for the Salesforce platform, don’t wait to reach out to us at sales@hicglobalsolutions.com

Related Articles
Expert Guide On Utilizing Agentforce for Seamless Quote & Case Creation

When it comes to managing customer journeys in Salesforce, speed and accuracy matter. That’s where Agentforce, a powerful extension layer, comes into play. Whether spinning up a new quote from an opportunity or logging a support case from a contact, Agentforce can help streamline these actions with minimal clicks and maximum context. In this blog, […]

Read More
How to Use Platform Events in Salesforce Flow for Real Time Updates

Platform events in Salesforce Flow are a great tool for creating real-time, event-driven apps that automate business operations with precision and speed. By integrating Platform Events’ publish-subscribe approach with Salesforce Flow‘s low-code features, you can automate processes, allow real-time system interaction, and optimize how your organization manages dynamic data changes. This guide will demonstrate how […]

Read More
Build a Dynamic Salesforce Data Viewer with hange kardo bas LWC

Lightning Web Components (LWC) is a modern JavaScript framework that is used for building responsive, dynamic applications on the Salesforce platform. In LWC, data flows from parent-to-child component. Variables marked as @api in the child component are open for a parent to pass values directly into the child’s HTML template, making the component interactable. To […]

Read More
Expert Guide On Nominal XIRR Calculation Using LWC in Salesforce

When building financial tools within Salesforce, handling irregular cash flows with precision is a must. Whether you’re developing investment trackers, portfolio performance dashboards, or funding monitors, calculating Nominal XIRR (Extended Internal Rate of Return) becomes essential. In this blog, you’ll learn how to build a Lightning Web Component (LWC) in Salesforce that calculates Nominal XIRR […]

Read More
Beginners Guide to Making Your LWC Component Multilingual

If you’re wondering how to make your LWC component multilingual, you’re already ahead of the curve. Global users expect content in their native language, and Salesforce gives you the tools to deliver exactly that. With Custom Labels and the Translation Workbench, you can easily localize your Lightning Web Components without touching a single line of […]

Read More
Hands-On Guide Building a Drag-and-Drop Form Builder Using Lightning Web Components

Drag-and-drop interfaces are a user experience staple, and when paired with the power of Lightning Web Components (LWC), they unlock dynamic, highly interactive Salesforce components. In this blog post, we’ll walk you through how to build a custom drag-and-drop form builder in LWC. Users can drag form fields like text inputs and dropdowns into a […]

Read More
Our Location worldwide
Indian Flag India
3rd Floor, A-10, Pegasus Tower, Sector 68, Noida, Uttar Pradesh 201301 +91-1203117884
United States of America Flag USA
333 West Brown Deer Road Unit G – 366 Milwaukee WI, USA 53217 +1(262) 310-7818
United Kingdom Flag UK
7 Bell Yard, London, WC2A 2JR +44 20 3239 9428
Canada Canada
HIC Global Solutions INC
6D - 7398 Yonge St #1124 Thornhill, ON L4J 8J2 Canada +1(262) 310-7818