Skip to Content
Technical Articles
Author's profile photo Ankit Gupta

Sending Mail Via SAP MII Attachment or table in Mail body

In today’s world, habit of reading an E-mail can differ person to person while there is lot of data we must put in mail. As some of people might want to see data as an attachment in mail, but many of us want to have everything paste into the Mail body as content itself. As nobody has time to save endless sheets in their system.

To counter this problem in while sending Mail via MII, it provides both functionality to user to attach data sheet (txt file, csv file, pdf file) into the mail as well as you can create html tables in the Mail to show the data into mail body.


Prerequisite for this functionality to work.

  1. Mail server configuration in MII (please refer to link
  2. Basic XSLT language understanding.
  3. Pinch of html.

As described in above blog, after configuring the mail server in MII we are ready to proceed with sending data with different approaches.

Let’s check both approaches one by one:

Approach-1: Send Attachment in mail using SAP MII.

  • Get data from source system. (preferably XML)
  • manipulate the data according to the requirement (format that we want to send) let’s say (.csv file)
  • By using the write file action block save file in the web folder.
  • while sending mail paste E-mail address in To and from parameter and for picking the file please use the attachment parameter from action block as below.

Mail Action Block configure links:

Figure:1 Link_attachmentViaMail

Sample BLS in SAP MII:


Fig.2 BLS_AttachmentViaMail

Output in MailBox:

Fig.3 Output_attachmentViaMail


Approach:2 Create html table in mail body using SAP MII.

  • Get data from source system (preferably XML)
  • For creating the table, we need to use XSLT. Sample XSLT example (
  • Content type will be “text/html”
  • Configure mail action block with below parameter.

Mail Action Block configure links:

Figure:4 Link_HTMLTableViaMail

Sample BLS in SAP MII:


Fig.5 BLS_HTMLTableViaMail

Output in Mailbox:


Fig.6 Output_HTMLTableViaMail


This is how we can use MII mail functionality to send data using Attachment or paste it in mail body.

Hope you have enjoyed this blog while reading. If you have any comments/queries or suggestion, please write those in the comment section.


Happy Reading.

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.