Back

How to Send Emails via Outlook API from your Salesforce Org

3min
1

Hi there. This is Salesforce Developer Vladimir Zhutenko. Recently, one of our clients experienced a necessity in sending emails via Microsoft Outlook from his SF org. So, I’ve come up with a solution, which I will describe below.

How to use Microsoft Graph API

Salesforce has a​ solution for redirecting messages to the SMTP-server using Email Relay Activation. With this function, you can turn all messages to the client-server. But this option isn’t suitable since the redirection of letters will be applied to all letters sent from Salesforce.

Therefore, it was decided to find another solution, and it became the Microsoft Graph API. We can manipulate your account information and interact with other Microsoft accounts and products using this API. But, most importantly, it solves our problem, sending letters via Outlook.

The first step is to understand authentication in this system. The documentation offers two ways to get the token: “Get access on behalf of the user” and “Access without user participation.”

The first method is not fitting, as the user must participate in the authorization interface. Since we need to send letters in background processes, the second method is suitable for what you need. To use this method, it’s essential to perform a lot of actions, namely:

  • Create an application in the “Microsoft App Registration Portal”
  • Permit to send an email to your application
  • Obtain the consent of the administrator

Eventually, we can use these settings to get a token. But, again, more details you may find in the documentation.

2

Our application is configured for sending emails. A method for authorizing and receiving a token has been created. Next, we need a way of sending emails, and for this, we will use the Send mail method. This process is simple.

You need to create a Message object, which includes all the information about the letter and makes a POST request to a specific endpoint.

In the end, we have a solution that solves the problem of sending emails through Outlook. This solution is suitable for the corporate segment, where it is necessary to send emails within the organization.

However, this resolution has its drawbacks in the form of limits on the number of API calls in one context. So for sending one letter, you need to make two API calls: the first is to log in and get a token. The second is to send a letter. Specifically, it is possible to send no more than 99 emails in one context, which is also not bad.

Closing

Hope this article was helpful. For more information about our development, you may explore our website. If you have any issues or questions, please, do not hesitate to send us emails at contact@synebo.io.

Table of content
How to Send Emails via Outlook API from your Salesforce Org How to use Microsoft Graph API Closing
chat Сomments
No comments yet, be the first to leave one!
leave a comment
articles You might be interested in
No image available
How-to Guides and Tutorials
21 Nov 2023
How to Get Listed on Salesforce AppExchange
Pavel Vehera
Pavel Vehera
12min
No image available
Salesforce development
14 Nov 2023
Questions to Ask Your Potential Salesforce Implementation Partner
Pavel Vehera
Pavel Vehera
12min
Cover and internal images for blog post the role of communication in outsourcing teams
Salesforce development
07 Nov 2023
Mastering Communication: Strategies for Collaborating with Salesforce Development Outsourcing Team
Pavel Vehera
Pavel Vehera
13min
No image available
Salesforce development
31 Oct 2023
Tips For Choosing the Right Salesforce Consulting Partner
Pavel Vehera
Pavel Vehera
11min
1 (1)
Salesforce development
24 Oct 2023
How to Build an App for Salesforce AppExchange
Pavel Vehera
Pavel Vehera
14min
12
23 Aug 2023
How to Get the Most Out of Salesforce Reporting and Dashboards?
Sergii
Sergii
13 min
11
09 May 2023
How Do Slack and Salesforce Work Together?
Sergii
Sergii
13 min
10
05 Apr 2023
Salesforce Einstein, or How AI Betters Your CRM?
Alina
Alina
23 min
9
12 Jul 2023
Migration to Salesforce & Data Migration
Sergii
Sergii
14 min
8
28 Jun 2023
How Can Salesforce Experience Cloud Help Your Business?
Sergii
Sergii
35 min
7
14 Jun 2023
Salesforce Developer Career
Alina
Alina
24 min
6
21 May 2023
Everything You Need to Know About Sales Cloud
Sergii
Sergii
39 min
5
17 May 2023
Project Manager Career With Salesforce
Alina
Alina
26 min
4
03 May 2023
What Is Flow, and Why Is Everyone So Obsessed With It?
Sergii
Sergii
17 min
3
19 Apr 2023
Salesforce Admin Career
Sergii
Sergii
30 min
2
05 Apr 2023
How to Kick-Start Career With Salesforce?
Alina
Alina
24 min
1
28 Aug 2023
Salesforce Products
Sergii
Sergii
28 min
No image available
22 Mar 2023
Intro to Salesforce Nerds Podcast
Alina
Alina
4 min
Neurodivergent side of Salesforce
06 Sep 2023
Neurodivergent Side of Salesforce with Paul Ginsberg
Alina
Alina
56 min
36
02 Aug 2023
Salesforce Implementation: Main Challenges and Best Practices
Alina
Alina
13min
Salesforce Nerds are Taking a Break
07 Sep 2023
Salesforce Nerds are Taking a Break
Alina
Alina
3 min
35
17 Jul 2023
What is Salesforce Experience Cloud, and What You Get From It?
Alina
Alina
10min
1
20 Jul 2023
CI/CD: Transforming Salesforce Development with DevOps
Alina
Alina
16min
33
31 May 2023
How and Why to Use Salesforce for Nonprofits?
Alina
Alina
6min
1
27 Apr 2023
Salesforce Sales Cloud from A to Z
Alina
Alina
6min
image (1)
30 Jul 2023
All Whats and Whys of Ecommerce Automation With the Power of Salesforce
Alina
Alina
4 min
1
30 Mar 2023
Salesforce Licenses: How to Understand and Choose?
Alina
Alina
6min
1
27 Apr 2023
Main Benefits of Classic to Lightning Migration
Alina
Alina
4min
1
14 May 2023
What is Salesforce Flow, and Why Do You Need It?
Alina
Alina
4min
1
19 Jan 2023
15 Types of Salesforce Clouds
Alina
Alina
5min
1
06 Dec 2022
5 Examples of the Best CRM for Nonprofit Organizations
Alina
Alina
5min
1
04 Nov 2022
What Is Hybrid Work, And How to Make It Work?
Alina
Alina
5min
1
05 Aug 2022
Salesforce Security in Plain Words
Alina
Alina
7min
1
08 Apr 2022
We Help Ukrainians Take the Salesforce Developer Course
Kristina
Kristina
4min
1
10 Mar 2022
21 Best Nonprofit Software Tools to Enhance Your Work
Kristina
Kristina
16min
1
30 Aug 2022
What is Beneficial in CRM for Nonprofits?
Kristina
Kristina
7min
1
25 Jan 2023
CMS Hub: The Guide to Managing Your Website
Kristina
Kristina
10min
1
10 Aug 2021
How to Find the Best Company for Developing Your Org in Salesforce
Synebo
Synebo
3min
1
17 Mar 2023
What is Salesforce Product Development Outsourcer (PDO)?
Synebo
Synebo
4min
1
28 Jul 2018
3 Steps for Salesforce App Development Lifecycle
Synebo
Synebo
4min
1
16 Apr 2018
How to Deploy Angular App to Salesforce: Developer Insights
Synebo
Synebo
6min
1
29 May 2018
How to Start Salesforce Career with Salesforce Certification
Synebo
Synebo
5min
1
05 Apr 2018
How to Send Emails via Outlook API from your Salesforce Org
Synebo
Synebo
3min
1
29 Mar 2019
4 Reasons Why You Shouldn’t Be Afraid of Outsourcing Software Development
Synebo
Synebo
4min
1
18 Feb 2022
The Anatomy of Dynamic Programming [with Codes and Memes]
Synebo
Synebo
11min
1
16 Feb 2018
6 Examples of UI/UX Design Mistakes and How to Avoid Them
Synebo
Synebo
6min
1
24 Oct 2022
Social Media CRM, or How to Get Closer to Your Customers
Alina
Alina
4min
1
21 Feb 2022
Commerce Cloud B2B vs. B2C. What Is the Difference?
Synebo
Synebo
5min
1
27 Sep 2022
Hows, Whys, and Whats of AI in CRM
Alina
Alina
4min
1
27 Jan 2022
8 Ways to Streamline Your Business with Salesforce Development
Kristina
Kristina
7min