SAP Cloud Platform Integration (CPI) Part 23 – Step-by-Step Guide to Mail Adapter Configuration with Attachments

1 year ago 29
email adapter configuration in sap cpistep by step guide to email configuration with attachment

This is the 23rd post in my blog series on “SAP CPI – Cloud Platform Integration for beginners”. In this post we will see the how-to setup mail server details in CPI Mail adapter and also configure the attachment option.

Overview of this blog series:

  1. SAP CPI Introduction
  2. SAP BTP tools and features overview (BTP, Global Account, Sub-Account, Entitlements, Connectivity, Security)
  3. SAP CPI Web IDE overview
  4. Registering a trial account and enrolling to SAP CPI service
  5. Deep dive into Cloud Integration features with real world scenario example
  6. Use cases of palette functions
  7. Adapter configurations
  8. Using Cloud connector for connecting to backend SAP systems
  9. Overview on API Management & Open Connectors
  10. Integration using Open Connectors with real world example

In short, below is the content we will elaborate in this tutorial:

  1. Overview on Mail Adapter
  2. IFlow Setup

Before we proceed with our tutorial, we would like to give you an opportunity to join our ZAPYard’s learning community where we have more than 32 groups and more than 1000 real SAP Consultants interacting with each other daily. Only SAP topics and not BS. Else, they will be banned from the community without warning. 👇👇👇👇

If you want to be part of ZAPYard’s Discussion Community, please feel free to check the below Link. We Ask, Answer, Help and Learn Together. There are more than 32 groups from different topics like RAP, BPT, Fiori, iRPA, CAI, CPI, PI/PO, ABAP on HANA, SAPUI5, SAP Build, SAP Adobe Forms, ChatBots, SAC etc. Join any group of your interest and interact with our Community.

Join ZAPYard’s WhatsApp Community

1. Overview on Mail Adapter

SAP CPI (SAP Cloud Platform Integration) provides a comprehensive set of tools and capabilities for integrating various systems and applications within an organization. One of the key features of SAP CPI is its Mail Adapter, which allows seamless integration with email services and enables the exchange of data and attachments.

The Mail Adapter in SAP CPI acts as a bridge between the integration platform and email systems such as Microsoft Exchange, Gmail, or any other SMTP/POP3-compliant mail server. It provides the ability to send and receive emails, along with their attachments, as part of integration scenarios.

Here are some key aspects and capabilities of the SAP CPI Mail Adapter:

Configuration:

The Mail Adapter can be easily configured within SAP CPI using the web-based integration flow editor. Administrators can define settings such as mail server details, authentication credentials, email formats (e.g., plain text or HTML), and attachment handling options.

Email Sending:

With the Mail Adapter, SAP CPI can send emails from integration flows to external recipients or internal mailboxes. It supports various email attributes like sender, recipient(s), subject, body, and priority. Attachments can also be included by specifying the file location or providing the file content directly within the integration flow.

Email Receiving:

The Mail Adapter allows SAP CPI to receive incoming emails and process their contents. It supports the retrieval of email attributes such as sender, recipient(s), subject, body, and attachments. Integration flows can be triggered based on the arrival of new emails, enabling automation and integration with other systems.

Attachment Handling:

The Mail Adapter facilitates the handling of email attachments within SAP CPI. Attachments can be extracted from incoming emails and processed according to the integration flow’s requirements. They can be saved to local directories, transformed, or forwarded to other systems as needed.

Error Handling and Monitoring:

SAP CPI provides robust error handling and monitoring capabilities for the Mail Adapter. It allows administrators to track the status of email processing, monitor incoming and outgoing messages, and handle exceptions or failures during integration flows involving the Mail Adapter.

2. IFlow Setup

The SAP CPI Mail Adapter does not support request-reply functionality primarily because of the asynchronous nature of email communication.

When using the Mail Adapter, the communication between the integration flow in SAP CPI and the email server follows an asynchronous pattern. The integration flow can trigger the sending of an email or listen for incoming emails, but it does not maintain a direct, synchronous connection with the email server.

Hence, use SEND palette function for email scenarios.

Regarding the mail adapter properties:

Address – SMTP mail address

Proxy type – If its through cloud connector, mention on-premise or else Internet.

Location ID – of cloud connector

Protection – Off / STARTTLS Mandatory/STARTTLS Optional

Authentication – None / Plain Username Password / Encrypted Username Password

Under the processing tab,

From – Email From

To – Email To

Cc/Bcc

Subject – Mail subject. Here we can mention dynamic properties/header which can flow at runtime as shown below.

Mail Body – We can pass the incoming payload as mail body like below or configure a mail body as per requirement.

Body-Mime type – The content type of the body section. If its Text/HTML, then if there are any html elements, it would be converted. If you want to send as it is, then choose Text/Plain. There are many other options also. Feel free to explore.

Body Encoding – UTF-8

For Mail attachments,

SAP has provided 2 options. We can create an attachment by passing the header content or the body content.

We can see in the below image, where we are passing the stacktrace header (which we set in previous content modifier step, ${exception.stacktrace}). Mention the name of the attachment also.

Add Message attachments – If there are any attachments sent by the sender and the same has to be transmitted to the receiver, then this option should be enabled.

Content transfer Encoding – Automatic

Overall Setup:

Mail:

By this way, we can configure the mail adapter and use it in IFlow. Thanks for reading this blog. Happy learning!

Please follow our LinkedIn PageLinkedIn Group , Facebook PageFacebook GroupTwitter , Instagram and Telegram SAP Technical Group Signal Group

Do not forget to SUBSCRIBE to our YouTube Channel for Free Courses and Unconventional Interesting Videos.

Do join ZAPYard’s Learning Community.

Read Entire Article