Mail Adapter - Attachments

How to get Mail Attachments using "Mail Adapter" in XI?
I will receive email with some files (with defined format). I need to put the data of file in a RFC.
When I use "Mail Adapter", the XI send the attachments to XML?

Hi,
  Extremely sorry, the links are,
/people/pere.diaz/blog/2005/07/14/broadcasting-reports-via-mail-with-pdf-attachment
https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/1685 [original link is broken] [original link is broken] [original link is broken] [original link is broken] [original link is broken] [original link is broken] [original link is broken] [original link is broken]
/people/michal.krawczyk2/blog/2005/12/18/xi-sender-mail-adapter--payloadswapbean--step-by-step
Please ignore the previous post, sorry again.
Anirban.

Similar Messages

  • Regarding Receiver Mail Adapter Attachments formats

    Hi Xians,
    when we configure Receiver Mail Adapter, we get the payload as Attachments in XML format. Does it support any other format apart from xml like text, pdf etc
    Regards,
    Varun

    Rajesh wrote:
    Yes it supports all you need to do for conversion is to use MessageTransform Bean in adapter modules
    and use parameter contentDispositon and contentDescirption things for setting different formats
    Hi Rajesh,
       Thanks for your reply. Can you please provide relevant blogs or any other docs on the same
    Regards,
    Varun

  • Sender Mail Adapter Configuration - Process Multiple Attachments

    Dear sirs,
    I need to process several attachments at the same mail message as individual payloads.
    In default configuration of sender mail adapter only the body of message is used as payload.
    So I added PayloadSwapBean Module at Processing Sequence and it processed the attachment I set in Module Configuration.  I'm not able to process all attachments available, just one attachment is sent to PI pipeline.
    How can I process all attachments of a single mail message?
    Thank you in advance.
    Fabio Purcino

    Hi Jose,
    We are trying to implement reading multiple attachment in sender mail adapter. 
    Our Requirement is : Reading a mail having multiple .xls files. This should be read and converted to payload .
    package multiswap;
    //import com.sap.aii.adapter.xi.ms.XIMessage;
    import com.sap.aii.af.lib.mp.module.*;
    import com.sap.aii.af.lib.trace.Trace;
    import com.sap.aii.af.sdk.xi.mo.Message;
    import com.sap.aii.af.sdk.xi.mo.MessageContext;
    import com.sap.aii.af.sdk.xi.mo.xmb.XMBMessageOperator;
    import com.sap.aii.af.sdk.xi.mo.xmb.XMBPayload;
    import com.sap.aii.af.sdk.xi.util.PayloadType;
    import com.sap.aii.af.service.auditlog.Audit;
    import com.sap.aii.af.service.cpa.*;
    import com.sap.engine.interfaces.messaging.api.MessageDirection;
    import com.sap.engine.interfaces.messaging.api.MessageKey;
    import com.sap.engine.interfaces.messaging.api.Payload;
    import com.sap.engine.interfaces.messaging.api.auditlog.AuditLogStatus;
    import java.util.Hashtable;
    import java.util.Iterator;
    import java.util.Locale;
    import javax.ejb.*;
    public class MultiSwapRead
        implements SessionBean, Module
        private static final String VERSION_ID = "$Id: //tc/xpi.af/NW731EXT_07_REL/src/_af_application_ejb_module/ejbm/api/com/sap" +
    "/aii/af/app/modules/PayloadSwapBean.java#1 $"
        private static final Trace TRACE = new Trace("$Id: //tc/xpi.af/NW731EXT_07_REL/src/_af_application_ejb_module/ejbm/api/com/sap" +
    "/aii/af/app/modules/PayloadSwapBean.java#1 $"
        private static final String SIGNATURE_PROCESS = "process(ModuleContext , ModuleData)";
        protected Hashtable cachedChannels;
        protected SessionContext myContext;
        public MultiSwapRead()
            cachedChannels = new Hashtable();
        public void ejbRemove()
        public void ejbActivate()
        public void ejbPassivate()
        public void setSessionContext(SessionContext context)
            myContext = context;
        public void ejbCreate()
            throws CreateException
        public ModuleData process(ModuleContext moduleContext, ModuleData inputModuleData)
            throws ModuleException
            if(TRACE.beLogged(200))
                TRACE.entering("process(ModuleContext , ModuleData)", new Object[] {
                    moduleContext, inputModuleData
            ModuleData outputModuleData;
            Iterator itr;
            outputModuleData = inputModuleData;
            String chid = moduleContext.getChannelID();
            TRACE.infoT("process(ModuleContext , ModuleData)", ModuleCategories.SAP_MODULE_ROOT, (new StringBuilder()).append("performing payload swap for channel ").append(chid).toString());
            LookupManager lman = LookupManager.getInstance();
            Channel chan = null;
      try {
      chan = (Channel)LookupManager.getInstance().getCPAObject(CPAObjectType.CHANNEL, chid);
      } catch (CPAObjectNotFoundException e1) {
      // TODO Auto-generated catch block
      e1.printStackTrace();
      } catch (CPAException e1) {
      // TODO Auto-generated catch block
      e1.printStackTrace();
            Direction direction = chan.getDirection();
            String swapkey = moduleContext.getContextData("swap.keyName");
            String keyvalue = moduleContext.getContextData("swap.keyValue");
            Object obj = inputModuleData.getPrincipalData();
            Object pivotedObj = inputModuleData.getSupplementalData("mp.pivoted");
            boolean pivoted = pivotedObj == null || !(pivotedObj instanceof Boolean) ? false : ((Boolean)pivotedObj).booleanValue();
            Message mo = null;
            if(obj instanceof com.sap.engine.interfaces.messaging.api.Message)
                mo = (Message)((com.sap.engine.interfaces.messaging.api.Message)obj);
            } else
            if(obj instanceof MessageContext)
                mo = ((MessageContext)obj).getMessage();
            } else
                TRACE.warningT("process(ModuleContext , ModuleData)", ModuleCategories.SAP_MODULE_ROOT, "no message found");
            if(mo != null && XMBMessageOperator.numberOfPayloads(mo) > 0)
               // String midstr = XMBMessageOperator.getMessageId(mo).toString();
                MessageKey auditkey = new MessageKey(((com.sap.engine.interfaces.messaging.api.Message) mo).getMessageId(), com.sap.engine.interfaces.messaging.api.MessageDirection.INBOUND);
                itr = (Iterator) mo.getAttachments();
                if(swapkey != null && keyvalue != null)
                    StringBuffer textSwappingbyBuf = new StringBuffer();
                    textSwappingbyBuf.append("Swap: swapping by '").append(swapkey).append("' ? '").append(keyvalue).append("'");
                    String textSwappingby = textSwappingbyBuf.toString();
                    TRACE.infoT("process(ModuleContext , ModuleData)", ModuleCategories.SAP_MODULE_ROOT, textSwappingby);
                    Audit.addAuditLogEntry(auditkey, AuditLogStatus.SUCCESS, textSwappingby);
                   while (itr.hasNext()){
                    boolean swappedp = swapPayloads(mo, swapkey, keyvalue);
                    String swappedStatus = swappedp ? "Swap: successfully swapped" : "Swap: no matching payload found";
                    Audit.addAuditLogEntry(auditkey, AuditLogStatus.SUCCESS, swappedStatus);
                } else
                    StringBuffer textInvalidBuf = new StringBuffer();
                    textInvalidBuf.append("Swap: parameter missing ");
                    if(swapkey == null)
                        textInvalidBuf.append("swap.keyName");
                    if(swapkey == null && keyvalue == null)
                        textInvalidBuf.append(" and ");
                    if(keyvalue == null)
                        textInvalidBuf.append("swap.keyValue");
                    String textInvalid = textInvalidBuf.toString();
                    TRACE.warningT("process(ModuleContext , ModuleData)", ModuleCategories.SAP_MODULE_ROOT, textInvalid);
                    Audit.addAuditLogEntry(auditkey, AuditLogStatus.WARNING, textInvalid);
            } else
                String messageEmpty = "Swap: message is empty or has no payload";
                TRACE.infoT("process(ModuleContext , ModuleData)", ModuleCategories.SAP_MODULE_ROOT, messageEmpty);
            return outputModuleData;
        private static boolean swapPayloads(Message mo, String swapkey, String keyvalue)
            swapkey = swapkey.toUpperCase(Locale.ENGLISH);
            keyvalue = keyvalue.toUpperCase(Locale.ENGLISH);
            int ifound = -1;
            for(int i = 0; i < XMBMessageOperator.numberOfPayloads(mo); i++)
                XMBPayload pldi = XMBMessageOperator.getPayload(mo, i);
                String pldivalue = null;
                if(swapkey.equals("PAYLOAD-DESCRIPTION"))
                    pldivalue = pldi.getPayloadDescription();
                } else
                if(swapkey.equals("PAYLOAD-NAME"))
                    pldivalue = pldi.getPayloadName();
                } else
                    pldivalue = pldi.getContentAttribute(swapkey);
                if(pldivalue == null)
                    continue;
                pldivalue = pldivalue.toUpperCase(Locale.ENGLISH);
                if(pldivalue.indexOf(keyvalue) < 0)
                    continue;
                ifound = i;
                break;
            if(ifound >= 0)
                XMBPayload pldfound = XMBMessageOperator.getPayload(mo, ifound);
                if(pldfound.getPayloadType() != PayloadType.APPLICATION)
                    XMBPayload pldapp = XMBMessageOperator.getApplicationPayload(mo);
                    if(pldapp == null)
                        pldfound.setPayloadType(PayloadType.APPLICATION);
                    } else
                        pldapp.setPayloadType(PayloadType.APPLICATION_ATTACHMENT);
                        pldfound.setPayloadType(PayloadType.APPLICATION);
                    TRACE.infoT("process(ModuleContext , ModuleData)", ModuleCategories.SAP_MODULE_ROOT, "successfully swapped");
                return true;
            } else
                TRACE.warningT("process(ModuleContext , ModuleData)", ModuleCategories.SAP_MODULE_ROOT, "no matching found");
                return false;
    We couldn't go further. Please have a look in highlighted code.
    Regards,
    Kesava.

  • How to handle Multiple attachments in sender Mail Adapter

    Hi,
         In our requirement is mutiple documents send through mail adapter, In custom java module we read the each document details and do it bussiness process. But now i am not able to read the multiple files at a time. we are able to read single file only. So plz give the solution for that.
    1) How to send multiple attachments(like word, PDF, JPG etc..) using mail apapter.
    2) How to read multiple attachments in custom java module.
    Thanks & Regards
    Vijay

    Hi Vijay,
    Go through this weblog this explains steps to multile attachments.
    /people/sravya.talanki2/blog/2006/01/12/xi-triggering-e-mails-with-multiple-attachments--problems
    Regards,
    Ashwin.

  • Read multi-tabbed excel file attachments from Sender Mail Adapter.

    There is a need to read excel attachments from incoming email to a
    mailbox. We know we can use Sender Mail adapter to easily read .xml, .txt
    or .csv attachments.
    For excel attachments we know from SDN that you have to write
    adapter modules to handle excel. However the excel file we need to read has
    multiple worksheets(tabs) and data may be contained in any of them.
    Is it possible to use SAP XI Mailsender adapter to read such a file as an attachment? What kind of module development would we need for this? I am not much of a Java programmer so examples or links to other documentation would help.
    Thanks,
    Rudra

    Rudra,
    Use Java Mapping.  There is a free java api available called JExcelAPI to achieve this. 
    Shabarish's blog describes about this.  This might be helpful to you
    /people/shabarish.vijayakumar/blog/2009/04/05/excel-files--how-to-handle-them-in-sap-xipi-the-alternatives

  • Query related to multiple attachments in mail adapter

    Hi,
    I have a query related to multiple attachments in receiver mail adapter.
    I have successfully configured mail related scenarios but now I have another requirement in which I have multiple source files in one directory and I want to send one mail for multiple files as mail attachment using receiver mail adapter. Can anybody help me how to achieve multiple attachments in reciever mail adapter.
    To clarify the requirement more let us take an example
    Ex: I have 5 input files in the source which I pick up using additional files option in the sender file adapter, now I want to send those 5 files into one mail with 5 attachments. Can anybody explain how 5 different payload will be sent as multiple attachments in one mail.
    For your information I used, options like "keep attachments" , some parameters in module processesors etcs...but not able to find out as how exactly it will be achieved.......I dont want to use BPM collect pattern for this.....
    Need your help on this issue. Please suggest the solution as how it can be achieved using receiver mail adapter.
    Thanks & Regards
    Prabhat

    Hi,
    I resolved the issue on my own. Thanks for your help and support.
    Thanks & Regards
    Prabhat

  • Mail Adapter to Soap Adapter keeping the attachments - How?

    Hi guys,
    I am working on a scenario where I should pull emails from an Exchange server and I should forward them (with their attachments) to a separate systems via a Web Service.
    So far I have been able to pull the emails using the Mail Adapter and I get to see them in the monitoring tool of PI with their attachment(s).  But what I am not sure of is how I should forward these emails to the external system using a web service.
    This system should expose this web service that should use something similar to SOAP with attachments (I guess) and then PI should forward these attachments using the receiver SOAP adapter with the "keep attachments" option selected.
    Is this something that could work as simply as this (by configuring these two adapters to keep their attachments) OR will I need to do some more fancy stuff?
    Thanks for any advice you can give me on this.
    Aldo

    Hi Stefan,
    thanks for your replay.
    Yes, I understand that the mail should be in an XML message.  And with that part we are doing OK.  We have managed to send the XML between the systems.
    However, what I don't understand is how to pass the attachments.
    How should the receiving system receive them?  if they are not in the XML message itself how are these going to be passed over?
    Will the SOAP envelop have some kind of link or reference to the attachments?
    The receiving system is a SAP CE system and it's based on Java.  Can they expose a service that will somehow handle these attachments?
    Could you explain this part to us?  this is where we get confused.
    Thanks for your help in advance,
    Aldo

  • Receiver mail Adapter Rename Attachments

    Hi Experts,
    In an Proxy --> XI --> Mail scenario, how do I configure the Mail Receiver Adapter to rename attachments?
    There is a PDF file and a DOC file that the Proxy is sendign to PI and I can see them in the payload with filenames file1.pdf and file2.doc
    How do I configure the Mail receiver adapter to send them as attachments retaining the same filenames? Can I atleast assign any other name to the files?
    Any method other than writing own Adapter Module?
    Regards,
    Shobhit

    Hi Shobhit
    If the attachment name is not dynamic (like timestamp) etc then you can use MessageTransformBean to change the attachment name at Mail adapter level.
    Transform.ContentDisposition attachment;filename ="yourfilename.extension"
    Transform.ContentDescription  attachment name
    Transform.ContentType  your type like text/plain or application/pdf.
    If you are using Mail package then you can  set the attachment name from mapping itself.(here even Timestamp and Dynamic values work)
    Thanks
    Gaurav

  • Handling multiple xls , xlsx attachments in mail adapter

    We have a (sender)mail with excel attachment scenario which is converted to an Idoc.
    Currently we are using ''PayloadSwapBean" for converting .xls attachment as main payload which is being read using an adapter module.
    PFA the screenshot.
    We have a new requirement as below
    when there are additional attachments in e-mail only the relevant template (MS Excel file) loaded.
    Handle all MS Excel format: .XLSX in addition to existing .XLS
    ability to process multiple excel file in a mail
    Kindly suggest ways to handle it.
    Regards,
    Kesava

    Could you please provide the location of  PayloadSwapBean file (.Ear,.jar,.class and also provide AL11) Transaction  in PI 7.31.
    Brief Background:
    We have a requirement to read multiple attachment from mail adapter. PayloadSwapBean is capable of reading only single attachment. We would like to see the code of PayloadSwapBean and modify accordingly to meet the requirement.
    If there is any alternative could please suggest the solution for read the multiple attachments in sender mail adapter.

  • Multi Attachments with ZIP or Mail Adapter (Outbound)

    Hi,
    is it possible to process one message with several attachments?
    I am thinking of a use in the Mail Adapter if you get several attachments or if you have one ZIP File with several documents. I would process the ZIP File in a Module and add each document as attachment.
    But how can I process then the different attachments? PayloadSwapBean is only for one file, right?
    Is it possible to produce during one Module Processing different messages?
    Thanks
    Philipp

    Hi,
    >>>>>is it possible to process one message with several attachments?
    of course it is
    >>>>But how can I process then the different attachments?
    you can add them in the adapter module for example
    Regards,
    michal
    <a href="/people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions"><b>XI / PI FAQ - Frequently Asked Questions</b></a>

  • Receiver mail adapter configuration for e-mail attachments

    Hi ,
    I need to send two files from sender file adapter to receiver mail adapter as e mail attachment.
    I want same attachment name in email as on sender side on FTP location.
    This is by pass scenario no object created in ESR.Please suggest how to handle this.
    For example if file name test.txt is send by file adapter then on mail  attachment name should be test.txt
    Thanks
    Mohit
    Edited by: Mohit Verma on Feb 10, 2012 4:18 PM

    Hi Mohit,
    Follow this blog for the ID configuration:
    http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/4383
    Create Receiver Determination and Interface Determination as described, and add a sender file CC and receiver mail CC according to your needs, plus sender and receiver agreements.
    In order to maintain the original file names, use a simple adapter module with the code mentioned here:
    http://forums.sdn.sap.com/thread.jspa?threadID=2122711&start=14
    Hope this helps,
    Greg

  • Mail Adapter: XIALL and attachments

    Hi All,
    I have a scenario with Sender Mail adapter, where I need data from both the Mail and the attachment.
    I tried using XIALL, but get a SAXParserException.
    Is there any other way that I can use both Main Payload as well as Attachment fields?
    Regards,
    Puloma.

    Like i mentioned only one of the two ( eithetr the attachment or the payload ) can be used as the source of your mapping.
    You might have to consider another option for this.
    Either use a BPM in your mapping and have duplicatre mails in your mail box. So, you can have both these attachment and the main paylaod in the different Receive step in your BPM and then have a N:1 mapping inside the BPM.
    Regards
    Bhavesh

  • Dynamic Filename in Receiver mail adapter is it possible without module?

    Hi,
    I need to send the file name in email adapter dynamically.Presently iam getting the filename as untitled.xml in the email .The keep attachments is checked in the mail adapter.
    I need to rename the file based on the input field name and timestamp .for example if i get the input field xxxx then the filename should be set as xxxx + timestamp .xml.I tried to use the UDF for dynamic configuration but it didnot help me out.Please help me.
    Thanks
    Rajesh

    Use below code snippet... It should work. If you want timestamp different change accordingly. Currently I do date followed by time as per my requirement.
    SimpleDateFormat simpledatFormat = new SimpleDateFormat("yyyyMMdd");
    Date date = new Date();
    String datewithYear = simpledatFormat.format(date);
    SimpleDateFormat simpledatFormat1 = new SimpleDateFormat("HHmmss");
    Date date1 = new Date();
    String datewithMs = simpledatFormat1.format(date1);
    DynamicConfiguration conf = ((DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION));
    DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File" , "FileName");
    String oldFileName=conf.get(key);
    String valueNew;
    if( oldFileName == null){
                           valueNew =oldFileNamedatewithYeardatewithMs+".xml";
    //set the new filename
    conf.put(key, valueNew);

  • Sender Mail Adapter - forcing content as an attachement

    Hi all,
    We are using the Sender Mail Adapter to pull emails from the inboxes of some users of an exchange server.  We use the Mail Package option.
    We have noticed that the content of the emails are by-default added as attachments when there are no real attachments to the emails.  However the content is not added as an attachment when one or more attachments are present in these emails.
    Is there a way of forcing the Sender Mail Adapter to always add the content as an attachment and keeping the other attachments as well?  and of course maintain the Mail Package message type as the main payload...?
    Many thanks,
    Aldo

    Hi Stefan,
    Thanks for your reply.  I am glad to hear that I am wrong again )
    In your opinion is it possible to force the Outlook Exchange server to add the content attachment every time?  I mean by doing some configuration on it...?
    The reason why we would like to do this is because when - in the content tag of a Mail Package message - we have MIME message parts that are of content-type text/html we are having problems in decoding the html back to a readable format.
    To do this we use the apache QuotedPrintableCodec Java class.
    This works fine when the content type of the message is just text/plain but we get an exception when we try with text/html.
    The exception we get is:
    org.apache.commons.codec.DecoderException: Invalid URL encoding: not a valid digit (radix 16): 13
    I don't know if this is because of the two character sets we have in the payload (utf-8 and iso-8859-1) or if it is for other reasons...
    If you could help me figure out how to forward any HTML email to another system in a readable format it would be great.
    Thanks for your support,
    Aldo

  • Sender "Mail" adapter - CSV file attachment

    Hi there
    I'm looking for some help in configuring a sender mail adapter that receives ".csv" files. I did read some blogs that mention using the "PayloadSwapBean" module to read the mail attachment instead of the mail content. My problem is to now convert the ".csv" file into a message. Is there a module that I can use ( is it the "MessageTransfomBean" ) and how. Any help would be appreciated.
    Thanks
    Salil

    Hi Salil,
    If you want to send a mail with a body and attachments, the message sender HAS to provide an XI message with attachments. I doubt a CSV file does justice.
    As Renjith said you need to convert CSV to XmL.
    A short description about the Standard Modules:
    MessageTransformationBean is a standard module used to apply the XSLT mapping to the adapter module by using <i>Transform.class</i> ( This xslt mapping is done to create a mail package, Dont confuse with the actual mapping in your case this is NOT for converting csv to xml).
    Also this module can be used to change the name and type of payloads by using <i>Transform.contentType</i>, <i>Transform.contentDisposition</i>, <i>Transform.contentDescription</i>.
    PayloadSwapbean is a standard module for replacing payloads with other payloads (SWAP)
    If you want to give each attachment a certain name use Parameters, <i>swap.keyname</i> for name of the payload and <i>swap.keyvalue</i>.
    I Hope the use of standard modules is understood.

Maybe you are looking for

  • Displaying Customer Exit Variable with derived value from another ODS

    Hi All, Sorry if this question has been answered before.  I searched the forums and could not find anything specific to my problem. I am new to BEx Query.  Customer is requesting a variable(s) be created which will be displayed as a column along with

  • View for Alert Authorization

    Hi, I would like to see user wise Alert authorization. How can?

  • Linked image scale percentage

    Why is the linked image scale percentage being rounded off in Illustrator CC?

  • Good (and free) MP3 tag edito

    Can anybody recommend a good (and maybe free) MP3/WMA tag editor ? It should be possible to mark and edit multiple files at the same time...Message Edited by Beano on 08-05-2005 03:28 AM

  • Dynamic MOH for call

    We are using ucce 8.0.2, cvp 8.0.1 and cucm 8.0.3. Client is asking different MOH for multiskilled agents say for example; An agent is a member of skill group A,B,C and D. Now if the agent recieve a call for his/her B skill group and put the caller o