Skip to Content
Technical Articles
Author's profile photo Peter Urbanek

Cloud Integration – Sending email from Microsoft 365 to SAP Backend in private network using SAP Cloud Connector

The topic

Recently I was participating on a project for a customer. One of the issues we faced was how to connect e-mails from Microsoft 365 with an SAP backend. The problem was that backends are in company’s inner network not reachable from the outside world.

We came with a solution to use SAP Integration Suite. Backend servers are already connected to SAP Businness Technology Platform through SAP Cloud Connector.

In this blog I’m going to describe the solution.


First of all, I suggest you to read this great blogpost by Franz Forsthofer Our solution is basically an extended version of Franz’s solution.

As prerequisites you need to prepare Microsoft Azure Active Directory. It is described in Frank’s blog in parts Create OAuth Client/App in Microsoft Azure Active Directory and Create an OAuth2 Authorization Code Credential in SAP CPI Tenant.

Configuration of the SAP Cloud Connector

As first step we need to have working SMTP connection to SAP backend from SAP BTP subaccount where SAP Integration Suite is subscribed.


SAP Cloud Connector configuration

Create new Cloud to On-Premise connection type Non-SAP System and TCP protocol. You need to specify SMTP port of the backend system you want to send e-mails to. Of course, this SMTP port have to be configured on the system. You can see port number in the transaction SMICM. As the virtual port you can chose any.


Cloud Connector configuration


The Solution

Configure the Mail Sender Adapter in an Integration Flow

For a communication to Microsoft 365 the Mail Sender Adapter is used. Configuration parameters are also described in the Franz’s blogpost.


Mail Sender Adapter configuration

Basically, you need to just configure Microsoft 365 SMTP address and provide Credential Name for Authentication created earlier as a part of prerequisite.

Enter the Address value ““. In the “Connection” tab, choose “OAuth2 Authorization Code” as “Authentication”. Protection must be defined as “IMAPS” for Microsoft 365.

Mail Sender Adapter configuration


Configure the Mail Receiver Adapter in an Integration Flow

In this part we are going to configure connection to the SAP backend using SAP Cloud Connector.


Mail Receiver Adapter configuration

On the tab Connection we need to provide Address of the Virtual Host and Location ID for Cloud Connector we’ve configurated earlier. You can find it also in SAP BTP Cockpit under tab Connectivity – Cloud Connectors


SAP BTP Cloud Connectors tab


Enter the Adress Value and Location ID. Set protection to Off and Authentication to None.


Mail Receiver Adapter configuration

In the processing tab we can specify parameters of emails which will be re-sent to SAP Backend. It is possible to use dynamic parameters. You can get more information about topic here :

Fill the parameter To with an e-mail address on the SAP backend where mails should be send.

Fill the parameters using expressions From : ${header.From}, Subject : ${header.Subject}, Mail Body : ${in.body} and check Add Message Attachements


Runtime Configuration

To set an attribute to be dynamically filled by a message header attribute you need to allow headers in the Runtime Configuration tab.

Fill the Allowed Header(s) with From|Subject


Runtime Configuration

These were necessary configuration steps for this scenario.


In this blogpost we described one of several possibilities how to use SAP Integration Suite and SAP Cloud Connector to integrate components from the the internet with components in your private network. There are many more integration scenarios you can do with SAP Integration Suite.

As this is my first blogpost on the SAP platform, fell free to provide me feedback, your thoughts of questions in the comment section. You can also follow me by clicking the green button above.

You can find community Q&A and post questions about Cloud Integration on this link.

Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Techedge-PI Consultor
      Techedge-PI Consultor


      It looks like the footer of the seventh image is not ok.

      That looks more like the mail receiver configuration, instead of the "Mail Sender Adapter configuration".

      Mail Sender configuration should not have proxy or LocationID, being a cloud platform (Microsoft).

      Best regards.

      Author's profile photo Peter Urbanek
      Peter Urbanek
      Blog Post Author


      thank you for your comment. I have corrected the typo.


      Best regards


      Author's profile photo Kashif Haleem
      Kashif Haleem

      Hi Peter,

      Thank you for your helpful blog. We are encountering a similar scenario where the connection is functioning correctly, and emails are being successfully sent. However, within our SAP Backend system, the emails are not displaying in the expected well-formatted manner. Instead, they appear as plain text. Additionally, the signature, including the image, is not being shown. We are seeking a solution to rectify the text formatting issue and ensure that the signature image is correctly displayed.


      how can we achive this?



      Author's profile photo Stephen Morrow
      Stephen Morrow

      Hi Kashif,

      You will need to change the Body Mime-Type to HTML to rectify this, and also tick the Add Message Attachments checkbox.


      Hope this helps