In this article we shall discuss the configuration of SAP XI Mail Adapter on the receiver side. The receiver mail adapter resides on the J2EE stack and converts the XI messages into emails and transfers them to email server or in simple words sends them as emails to intended recipient(s).
The adapter supports SMTP as well as IMPA4 protocol. Message protocol provides two options, namely XIALL and XIPAYLOAD. In the former entire SOAP message is sent as an attachment in mail along with the payload while in the latter only the message payload is sent.
Configuring the Receiver Mail Adapter
Let’s say you want to send incoming XML message as an email. The mail adapter provides two options – one using the mail package and one without using mail package. When you do not use mail package you have to provide the email header details (like To and From addresses, Subject line etc) in the adapter itself. There is no restriction on the XML message format or namespace. However, when you use mail package, you have to adhere to a specific format of the source XML.
The figure above on the left shows a typical message structure that should be used while configuring receiver mail adapter with mail package. The Message Type must be named as ‘Mail
’ and it must be present under the Namespace ‘http://sap.com/xi/XI/Mail/30’
. Your message is bound to fail in adapter engine if this is not adhered to. This helps you to dynamically set email parameters like sender, receiver mail subject etc.
The URL of the mail server should be specified as shown below depending on whether you use SMTP or IMAP4.
smtp://EmailServer
or imap://EmailServer/UserInbox
If your server required User Authentication, you can specify the same while configuring the adapter. If you want to request a delivery receipt, check the ‘Send Delivery Status Notification’ checkbox. The delivery receipt is delivered to the email address specified in the ‘To’ field. base64 content encoding is possible. The figure on the right shows a typical configuration of the receiver mail adapter.
The output using the mail package is as shown below:
If you do not use mail package, the XI message will be sent to the static addresses as specified in the receiver mail adapter configuration. A typical output is shown below:
If you use XIALL as Message Protocol, the entire SOAP message is sent as an email attachment along with payload as shown below.
The first attachment in the email message shown above is the SOAP message while the second attachment is the actual payload.
As with any other J2EE adapter, you can enhance the adapter further using the adapter modules which can be specified in the module tab of the communication channel. This article discussed the simplest way to work with mail receiver adapter in order to send mails from XI server.