mPower your cloud native application with email API from SAP Digital Interconnect – II
In the previous blog post (https://blogs.sap.com/2019/01/02/mpower-your-cloud-native-application-with-email-api-from-sap-digital-interconnect/) ; I shared how SAP Digital Interconnect can power email communications for your cloud native applications using a service powered by a RESTful email API.
A question is often raised to us ; Is it easy to use the API to deploy an email capability within an application?
There are two approaches to embedding an email capability within an application.
- Approach 1: Leverage platform notification workflow capabilities ; map the email notification template with the REST API format ; and set up publish end-points to your SAP Digital Interconnect email account end-points ( URL, credentials)
- Approach 2: Build a native email workflow / UI plugin for your application
We determined to have a closer look at Approach 2 and asked our development partner team within Xoriant to build out a POC java application using our email API , Spring Framework and Eclipse IDE
Here is a demo of the app built
Here are the steps taken to build it
Step 1 : Create a Spring project
Step 2: Name sample project (Here it is MobileBank) and add JARs required for Spring configuration in the lib folder present in WEB-INF
Step 3: Create email method for App
Step 4: Add email SDK JAR to build path
Step 5: Utilize SendMail class for email SDK and call sendMail with respective parameters ( see below)
Step 6: Email message composition UI end-points
Step 7: Deploy war file and execute. The plugin will render as below. Enter recipients (comma separated), sender name, subject and message and click on “Send Email” button. To send an HTML template select the checkbox HTML and choose file from your local drive.
That’s it. It took the Xoriant developers just a few hrs to build, deploy and demo this app and they were new to the API. You could do it as well.
Reach out to us
The team at SAP Digital Interconnect is here to help you power your interconnect communication use case . Please feel free to reach out to one of us here