Accessing SMTP Server using XOAUTH2 on SAP BTP
1. Cloud Connector Flow
1.1 Define Cloud Connector Mappings
Open your Cloud Connector and configure an SMTP connection to your local mail server.
Click on Cloud To On-Premise and then click the Add (+) icon to create a new mapping. (screenshot 1)
Map this Cloud Connector entry to the actual email server host and port—using your desired virtual host and port and the displayed settings of the screenshot.(screenshot 2)
screenshot 1

screenshot 2
3. Create also a mapping for the Authorization server.
4. Please fill in your desired virtual host/port with the actual internal host/port of the authorization server.
5. Also, include the resource path whenever you configure sub-resources of a host.(You can also set a generic '/' subpath)
Import certificates of your authorization server or email server in the cloud connector.
1.2 Define Cloud Connector Routes
Configure the destination service in BTP. In the BTP Cockpit, create an OnPremise destination:
Fill in the following properties:
-
ClientId: the client ID from your authorization provider.
-
ClientSecret: the client secret from your authorization provider.
Token Service URL: the virtual host (including protocol) mapped in the Cloud Connector to your provider’s token endpoint. (-http://internal-cloud-connector-url-example/oauth/token)
-
mail.smtp.port: the Cloud Connector’s virtual SMTP port.
-
mail.smtp.from: the sender address for outgoing emails.
-
mail.smtp.host: the Cloud Connector’s virtual host mapped to your internal email server.
authentication: OAuth2ClientCredentials
locationId: your cloud connector locationId
Manifest variables :
USE_CLOUD_CONNECTOR_FOR_SMTP_INTEGRATION=true
CLOUD_CONNECTOR_DESTINATION_NAME_FOR_SMTP_INTEGRATION=<your destination name>
Now, email integration will use a cloud connector with XOAUTH2 to communicate with your local server.
2. Internet Flow (Azure Exchange)
If your email server is on the internet, you should only configure the appropriate destination in BTP
Fill in the following properties:
-
ClientId: The client ID from your authorization provider. For Azure: <your Azure client ID>
-
ClientSecret: The client secret from your authorization provider. For Azure: <your Azure client secret>
-
Token Service URL: The auth token endpoint URL. For Azure: https://login.microsoftonline.com/{tenant-id}/oauth2/v2.0/token
-
mail.smtp.port: The provider authorization port, for Azure SMTP port (587).
-
mail.smtp.from: The sender address for outgoing emails. For Azure: <your sender email address>
-
mail.smtp.host: The provider authorization host, for Azure: smtp.office365.com
-
scope: The token scope—suggested for Azure: https://outlook.office365.com/.default
-
authentication: OAuth2ClientCredentials
Manifest variables :
USE_CLOUD_CONNECTOR_FOR_SMTP_INTEGRATION=false
CLOUD_CONNECTOR_DESTINATION_NAME_FOR_SMTP_INTEGRATION=<your destination name> // in future releases will optimize the name for the internet
Related Articles
Connection to Your SAP BTP PostgreSQL Database
Install the Cloud Foundry CLI (if needed) If you don’t already have the cf CLI on your machine, follow the installers or download a compressed binary from the V8 CLI Installation Guide: ...
Configure SAP Alert Notification service
1. Go to Service Marketplace and find Alert Notification service. 2. Finish installation wizard and create the instance. 3. Go to your alert-notification instance and configure subscriptions. 4. Create conditions based on the resources that interest ...
Connect to SAP Integration Suite /Cloud Foundry
To connect to SAP Cloud Foundry we have enabled a new way of connecting using SAML. This is because the public APIs of SAP Cloud Integration is not as good as the private APIs used in the Web. The guide video that shows how to connect Figaf to an ...
Create Service Keys for SAP CPI Cloud Foundry
For SAP CPI Cloud Foundry you have an option to use Service Keys to send messages. The Figaf Tool will not test the properties are correct before running tests. We need to create keys for both API and for Integration flow API access To create a ...
Create a git repository for SAP Cloud Integration
In this guide you will see how you can create a git repository for your SAP CPI/Cloud Integration system. Before you start you need 1. Have installed Figaf 2. Have connected it with a SAP CPI tenant 1. Create a git repository on forinstance github ...