Email Services in salesforce are automated processes that use apex classes to process details or content in the Email. When you have to send or receive some email from external systems then we can use email services in Salesforce. There are two types of Email Services in salesforce. They are Inbound Email Services and Outbound Email Services(already discussed in one of our blogs).
Emails received from external systems to salesforce use apex class to retrieve details and attachments in the email. Apex classes use the InboundEmail object to process the email.For example, we can create an email service that automatically creates account records based on the account information received in the Inbound Email.
Click on Setup--> Build--> Develop--> Email Services
Before creating Email Services, Create Apex classes that implement the Messaging.InboundEmailhandler interface. Using the handleInboundEmail method in that class, you can access an InboundEmail object to retrieve the contents, headers, and attachments of inbound email messages, as well as perform many functions.
Apart from Messaging.InboundEmailhandler, there are some predefined classes under Messaging Namespace.
InboundEmail.Header Object InboundEmail.BinaryAttachment Object InboundEmail.TextAttachment Object InboundEmailResult Object InboundEnvelope Object
After Creating Apex Classes based on requirement, Create an Email Service:
1. Click on New Email Service, Enter Email Service name
2. Choose the appropriate class which you created earlier. Choose the type of attachments you want to accept.
3. Click on the Advanced Email Security settings checkbox.
Note: Before enabling this option, make sure that your users’ email domains support at least one of the following protocols: SPF, Sender ID, or DomainKeys. When this option is enabled, salesforce.com uses these protocols to verify the legitimacy of the email sender's server. If the server passes at least one protocol and does not fail any, salesforce.com processes the email. If the server fails a protocol or does not support any of the protocols, then salesforce.com does not process the email.
4. Optionally, List the email addresses and domains from which you want this email service to receive emails. Separate multiple entries by commas. Leave this field blank if you want the email service to receive email from any email address or domain.
5. Choose whether to convert text attachments to binary attachments and active checkbox.
6. Configure Failure response settings and click on save.
Micropyramid is a software development and cloud consulting partner for enterprise businesses across the world. We work on python, Django, Salesforce, Angular, Reactjs, React Native, MySQL, PostgreSQL, Docker, Linux, Ansible, git, amazon web services. We are Amazon and salesforce consulting partner with 5 years of cloud architect experience. We develop e-commerce, retail, banking, machine learning, CMS, CRM web and mobile applications.
Django-CRM :Customer relationship management based on Django
Django-blog-it : django blog with complete customization and ready to use with one click installer Edit
Django-webpacker : A django compressor tool
Django-MFA : Multi Factor Authentication
Docker-box : Web Interface to manage full blown docker containers and imagesMore...