Dynamic filename in mail adapter

Hi,
how can I set the filename of a mail attachment dynamically in a receiver mail adapter (also dynamically configured)?
I had to uncheck the "keep attachment" because of our scenario.
If I check this box I get a .xml file which I can rename with the MessageTransformBean (but not dynamically?) but I get to much files in the mail.
Now I get a .dat file and want to rename it dynamically in e.g. dynamicName.txt.
Can you give me some input how to do that?
Thanks in advance
Dominic

Hi
<i>isn't it possible to set the filename of the attachment in the message-mapping?</i>
--->
Try writing this UDF so to get the name in mapping
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
conf.put(key,a); // a - parameter given to UDF that specifies filename
String ourSourceFileName = conf.get(key);
return  ourSourceFileName; 
Hope this helps

Similar Messages

  • Dynamic excel filename Receiver Mail adapter

    Hi all,
    May i know what is the way to dynamically set the file name of attachment in receiver mail adapter.
    Can we do using DynamicConfiguraion???
    If yes how?
    Thanks In Advance,
    H.L.Babu

    But i am not using any mail package.
    and also in adapter module i have written code like..
    byte by[] = generateExcel(is);
                      xp.setName(filename);
                      System.err.println("The name of the file."+filename);
                      xp.setContentType("application/vnd.ms-excel");
                xp.setContent(by);
                      System.err.println("After successful setting of XML Payload");
                msg.setDocument(xp);
                System.err.println("Message Set is successful");             
    But it is not getting the excact file name..
    Any coments..

  • Dynamic filename in Mail Receiver Adapter

    Hi,
    I am using File and Mail adapter. I need to pick the file from FTP server and Attach to the mail and send it.
    I am using Payloadswapbean & MessageTransforBean.
    I am not using IR ,  So files with different names should be picked and attach to the mail and send it.
    I am able to send it but the filename is not same as the source file name.
    What should i do for thefile name for attachment should be same as the source filename.
    "Points will be awarded"
    Regards,
    Jayasimha Jangam

    Hi Jayasimha,
    We can do this by "Adapter Specific Message Properties" of ur comunication channels.
    1.If u want to keep the output filename same as input filename, no need to use the UDF. only the 'adapter specific parameters' in both sender n receiver file adapter will do that.
    In case if u want to get the filename inside our mapping we have to create a user defined function
    which will return the filename and map it to one of our XML tags. 2nd point gives solution 4 that:
    2. If u want to generate an output file taking some input from the payload,then u hav to use the UDF.There u hav to populate the name.
    Pretty much.... if you set an attribute from the sender side, for example, you can use a UDF and access the particular attribute sent and use it in the mapping. In another example, where no attributes are sent from the sender, you can still actually set a particular attribute, say a filename derived from the payload, using a UDF, and enable the receiver attribute to use it. That's where the UDFs come in - either to get or set particular adapter specific message attributes.
    This will be a very helpful blog which solves ur query:
    /people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14
    Regards,
    Vinod.

  • Retrieval of attachment filename - receiver mail adapter

    Hi,
    I am using the mail adapter to receive an e-mail into PI. This e-mail has an attached CSV file.
    First, I am using the PayloadSwapBean to swap the application playload to the attachment payload
    Second, I am using the MessageTransformBean to transform the CSV file into an XML document
    These are both working fine and the message is then passing into the relevant message mapping.
    However, I would like to be able to use the attachment filename in the message mapping.
    Can anyone advise how to do this for the mail adapter ?
    I've done it loads of times for the file adapter but never the mail adapter (when using attachments) so I am a bit stumped.
    Any advice greatly received.
    Cheers
    Colin.

    Hi Progirl,
    I want to dynamically set the name of attachment in receiver mail Communication Channel.
    Example: IN__9907211000004_4048454000005_20081211_01000000002643
    The first two numbers 9907211000004 & 4048454000005 I want to read it from the message
    20081211 this is the date and
    And againg this number 01000000002643 is read from message.
    I read from your response. You had created adapter module for the similar purpose. Can you share it. Since I am new to  writing Adapter Module.
    Thank You in Advance.
    Mukhtar

  • Dynamic Subjet in Mail Adapter

    Hi everybody,
    Landscape: I would like to fill dynamically the "Subject" field in a Mail Adapter. We receive data from a JMS Adapter and if no rule match the condition, it will send an email with the DCJMSCorreleation in the subject or in the body. In addition, we can receive flat or xml files.
    I tried to use an Mail Package, with a XSLT mapping but it doesn't run with a flat file (XML Parser error in Integration Engine). Then, I tried to use a SOAP adapter but we encountered the same issue with the flat file.
    Is someone can help me?
    -> How to allow flat file handling in XSLT or SOAP Adapter?
    -> How to get value from the SOAP Document?
    Many thanks in advance,
    Regards,
    Landry

    Many thanks for your help!
    With a Java Mapping (or UDF), it works perfectly. Here the code of the Java Mapping used in order to fill the DCJMSCorreleationID in the mail's subject:
    // Retrieve the DCJMSCorreleationID
                   trace = (AbstractTrace) param
                             .get(StreamTransformationConstants.MAPPING_TRACE);
                   DynamicConfiguration attrib = (DynamicConfiguration) param
                             .get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
                   DynamicConfigurationKey fileKey1 = DynamicConfigurationKey.create(
                             "http://sap.com/xi/XI/System/JMS", "DCJMSCorreleationID");
                   DynamicConfigurationKey fileKey2 = DynamicConfigurationKey.create(
                             "http://sap.com/xi/XI/System/Mail", "THeaderSUBJECT");
    // Set the mail subject with the DCJMSCorreleationID
                   attrib.put(fileKey2, "Unknown DCJMSCorreleationID: "
                             + attrib.get(fileKey1));
    Regards,
    Landry

  • Content-Disposition - Dynamically set in Mail Adapter

    Hi All,
    I need to dynamically set the Content-Disposition in the receiver mail adapter so as to facilitate dynamic names for my attachment in the mail.
    In case i use messagetransform bean, I will have to hard code the name as part of the parameter value in the adapter.
    Is there any way i can utilize the ASMA and dynamic configuration here?
    The specified item was not found. - i referred the blog but instead of setting the
    attachmentXML.setName(mailFileName);
    attachmentXML.setContentType("text/xml");
    attachmentXML.setContent(by);
    I need to set the content disposition. Is there any way?
    Appreciate all help on this issue.
    Regards,
    Shabz

    Hi Vijay,
    Do have the solution for this? I also have the same requirement.
    Please forward me the solution.
    Thanks,
    Nat

  • XSLT Mapping with Dynamic Configuration for Mail Adapter

    Hi Guys,
    I am wondering if somebody can help me please.
    I have a requirement in which I need to pick up the file from FTP and email it to the user as an attachment with the same file name and content.
    I know it is possible via 3 method either by deploying adapter module or via XSLT or JAVA Mapping.
    I preferred XSLT Mapping because it is easier to use and we don't need to compile the code like JAVA Mapping.
    I have done the XSLT Mapping but the only problem I am facing is that how to copy the file name which we get it from Dynamic Configuration to the Mail ContentDisposition.
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:map="java:java.util.Map"
      xmlns:dyn="java:com.sap.aii.mapping.api.DynamicConfiguration"
      xmlns:key="java:com.sap.aii.mapping.api.DynamicConfigurationKey">
    <xsl:output indent="no" />
    <xsl:param name="inputparam"/>
    <xsl:template match="/">
    <!-- change dynamic configuration -->
        <xsl:variable name="dynamic-conf" 
            select="map:get($inputparam, 'DynamicConfiguration')" />
        <xsl:variable name="dynamic-key"  
            select="key:create('http://sap.com/xi/XI/System/File', 'FileName')" />
        <xsl:variable name="dynamic-value"
            select="dyn:get($dynamic-conf, $dynamic-key)" />
        <xsl:variable name="dummy"
            select="dyn:put($dynamic-conf, $dynamic-key, $new-value)" />
        <!-- copy payload -->
    I tried many option but unfortunately none of them worked.
    <Content_Disposition>attachment;filename="$inputparam"</Content_Disposition>
    <Content_Disposition>attachment;filename="$dynamic-conf"</Content_Disposition>
    <Content_Disposition>attachment;filename="$dynamic-key"</Content_Disposition>
    <Content_Disposition>attachment;filename="$dynamic-value"</Content_Disposition>
    <Content_Disposition>attachment;filename="$dummy"</Content_Disposition>
             <Content_Disposition>
                attachment;filename=
                <xsl:value-of select="dynamic-key"/>
             </Content_Disposition>
    I really appreciate if someone can please provide some guidance.
    Thanks,

    Hi,
    Yes u r correct it will show error in operation mapping.. bcoz u cannot check the DynamicConfiguration in Operation mapping...
    It will throw Exception..
    The parameter to UDF depends on ur requirement.... Let us know ur requirements exactly...
    If u r doing for file to file means no UDF required,, just check ASMA on both sides....
    Babu

  • Dynamic Filename in File adapter

    Hi,
    I am doing idoc-file scenario.I get the filename as a field in one of the segments of my idoc.Can anyone please let me know how i can get the filename from my idoc and use this filename in my file adapter.
    --Thanks

    Hi all,
    Thanks a lot for your replies.
    Please find below the inbound message that i get. Now i need to get the filename that i get in one of the segments and use that in the file adapter.
    <?xml version="1.0" encoding="UTF-8" ?>
    - <ZSSV_GENERIC_IDOC>
    - <IDOC BEGIN="1">
    - <EDI_DC40 SEGMENT="1">
        <TABNAM>EDI_DC40</TABNAM>
        <MANDT>100</MANDT>
        <DOCNUM>0000000000203015</DOCNUM>
        <DOCREL>620</DOCREL>
        <STATUS>30</STATUS>
        <DIRECT>1</DIRECT>
        <OUTMOD>2</OUTMOD>
        <IDOCTYP>ZSSV_GENERIC_IDOC</IDOCTYP>
        <MESTYP>ZSSV_GENERIC_MSG</MESTYP>
        <SNDPOR>SAPYRA</SNDPOR>
        <SNDPRT>LS</SNDPRT>
        <SNDPRN>YRACLNT100</SNDPRN>
        <RCVPOR>YXDTEST_GI</RCVPOR>
        <RCVPRT>LS</RCVPRT>
        <RCVPRN>IDES_LS1</RCVPRN>
        <CREDAT>20060420</CREDAT>
        <CRETIM>184948</CRETIM>
        <SERIAL>20060420184948</SERIAL>
        </EDI_DC40>
    - <Z1SSV_ITEMS_SUMMARY SEGMENT="1">
        <IDOC_SEQ_NUM>1</IDOC_SEQ_NUM>
        <TOTAL_REC_COUNT>50</TOTAL_REC_COUNT>
        <IDOC_SEG_COUNT>50</IDOC_SEG_COUNT>
        <OUTPUT_REC_LENGTH>90</OUTPUT_REC_LENGTH>
       <INTERFACE_DESCRIPTOR>OUT_RYDER_0001</INTERFACE_DESCRIPTOR>
      <b><HOST_FILENAME>TEST1</HOST_FILENAME></b>
      <RECORD_DELIMITER>^</RECORD_DELIMITER>
      <SEGMENT_DELIMITER>|</SEGMENT_DELIMITER>
      </Z1SSV_ITEMS_SUMMARY>
    In the file adapter, I have specified "%filename%.xml" as my file name and in variable substitution the reference is  "payload:ZSSV_GENERIC_IDOC,1,IDOC,1,EDI_DC40,1,Z1SSV_ITEMS_SUMMARY,1,HOST_FILENAME,1".
    I still get the same error "Message processing failed: Error during variable substitution: "
    Waiting for your help in this matter.
    Regards,

  • Dynamic attachment - receiver mail adapter

    when you have the required access-key in the XML, then you can do it similar as in Michal's blog.
    If you just want to send the attachmanet without email body, you need not create a new attachment, you can just set the file name with this line:
    payload.setContentType("application/xml;name=\"" + fileName + "\"");

    You should already have the the access key in subject from the UDF on pg13. Just change the last line to "return subject" from "return xml" then concat it with -nfe.xml
    Regards
    Asif K

  • Dynamic Mail Adapter Config

    Hi All,
    We're trying to use a dynamic mail direction in the mail adapter checking the Mail Package option as it's mentioned in: /people/michal.krawczyk2/blog/2005/03/07/mail-adapter-xi--how-to-implement-dynamic-mail-address (excellent blog).
    But we have a mapping error in the SXMB_MONI:
    RuntimeException in Message-Mapping transformation: Cannot produce target element /ns0:Messages
    In the mapping we have one source message with the content of the mail and the direction, and two different structures for target. One with the mail package structure and the other with the target content.
    Do you have any idea why we're having this mapping error?
    Thanks in advance!

    I'm trying to use the dynamic adress for mail adapter. So I've created an external object from the file mentioned in https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/1361. [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]
    Then I've done a multimapping, first message with the mail payload and the second with the contents of the mail.
    In configuration, I've checked the Mail Package option and execute the interface.
    Sender adapter and mapping was right, but there is an error in the mail adapter as follows:
    error occured: [2006-05-29T14:38:31Z] unable to call the mailer; com.sap.aii.messaging.srt.BubbleException: Failed to call the endpoint [null "null"]; nested exception caused by: com.sap.aii.messaging.util.XMLScanException: expecting start tag: Mail, but found MM57_V01_COM_MONTH_MAIL_FILE at state 1
    Any idea about this?
    Thanks in advance!!!!

  • Dynamic filename configuration via custom EJB

    Hi Experts,
                        We are doing a poc on whether we can do the dynamic filename configuration,i.e. set the file name dynamically in a custom EJB deployed on the server and called in the sender comm. channel of any J2EE based adapter.
    The requirement is for some interfaces, there is no mapping requirement other then setting the filename dynamically, which maybe based on a certain value of the input file or a specific portion of string in the payload.
    The custom EJB takes the namespace and attribute as input parameters along with other string manupulation parameters to determine the receiver file name. That is if we are using sender JMS adapter, we can have namespace = http://sap.com/xi/XI/System/JMS and attribute as DCJMSMessageProperty1. The bean would read the value and perform the manipulation based on certain other input parameters and set the file.
    There is one particular bean : AF_Modules/DynamicConfigurationBean but it does not allow us to manipulate the filename.
    Any help would be much appreciated.
    Regards,
    Shiladitya

    Hi,
    please refer to the following links for your reference
    Re: Reading Dynamic Configuration information in side adapter module.
    Re: Dynamic Filename in File adapter
    Regards,
    Bhanu

  • Regarding Receiver Mail adapter.

    Hi experts,
    iam looking at one off the weblog whick  Michal Krawczyk have created.
    /people/michal.krawczyk2/blog/2005/03/07/mail-adapter-xi--how-to-implement-dynamic-mail-address
    in this weblog michal have told to download the XSD file from service market place  and upload it in IR External definition it gives us target structure.What is the use off it, we can directly create the target structure.
    And also one more dought what is the use off checking parameter in mail Attributes use mail package.I dont have much knowledge on mail adapter please help me in this issue.
    i want to send parameters dynamically into receiver mail adapter in my project ie(TO,FROM,SUB and CONTENT) please send links and doc's on it.
    Note: Helpfull answer will be rewarded.
    Thanks & regards,
    Phani

    Hi raj,
    Once again thanks for the reply,I will explain my object,its is any 2 senarios in one object.
    1) file to proxy were i upload employee details in to infotype2010 after inserting what ever error records i will l store them in error table.
    2)ater geting error records if i get more then 25 i have to send file path and error records to receiver side. or if i get all sucess also i have 2 send sucess flag into receiver side.
    but i haveto pick data from different systems and i have to send the data into different mail ids i have to generate TO FROM CONTENT dynamically.
    onsite have prepared TS(Tecnical specs) in that spec they gave XIALL and SMTP.
    so my question is using this parameters can i post them dynamically or  not.
    if YES ? then how??
    please help me in this issue.
    if u still dont understand give me ur id  i will send my TS.
    Thanks and regards,
    phani

  • Xi 3.0: Mail adapter fails with "exception in method process"

    Hi.
    I configured the dynamic address for mail adapter following the fantastic-as-always weblog from michalgh.
    Althou everything seems to work fine (that is, i send correctly the email message) the A.F. returns an error with "exception in method process".
    I tried both async and sync case with the same result. In the sync case, the response contains:
    <!--  Call Adapter   -->
    <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="1">
      <SAP:Category>XIAdapterFramework</SAP:Category>
      <SAP:Code area="PARSING">GENERAL</SAP:Code>
      <SAP:P1 />
      <SAP:P2 />
      <SAP:P3 />
      <SAP:P4 />
      <SAP:AdditionalText>com.sap.aii.af.ra.ms.api.DeliveryException: Exception in method process.</SAP:AdditionalText>
      <SAP:ApplicationFaultMessage namespace="" />
      <SAP:Stack />
      <SAP:Retry>M</SAP:Retry>
      </SAP:Error>
    Any idea???

    Yes. There is also a response message in the imported structure.. it seems it should work as a kind of application ack with some info on the server that processed the mail.
    Anyway, in my server i get a 404 for the link you suggested.
    In the async case i don't get any error on the SXMB_MONI but only on the A.F.
    I attach the audit log for the async case:
    Audit Log for Message: ffb28585-3c53-0f4b-b366-7dd7a00513fc
    Time Stamp Status Thread ID Sequence No. Description
    2005-06-12 22:27:06 Success SAPEngine_Application_Thread[impl:3]_45 1118608026046 The message was successfully received by the messaging system. Profile: XI URL: http://CAPELAB010:50000/MessagingSystem/receive/AFW/XI
    2005-06-12 22:27:06 Success SAPEngine_Application_Thread[impl:3]_45 1118608026062 Using connection AFW. Trying to put the message into the receive queue.
    2005-06-12 22:27:06 Success SAPEngine_Application_Thread[impl:3]_34 1118608026093 The message was successfully retrieved from the receive queue.
    2005-06-12 22:27:06 Success SAPEngine_Application_Thread[impl:3]_34 1118608026375 The message status set to DLNG.
    2005-06-12 22:27:06 Success SAPEngine_Application_Thread[impl:3]_34 1118608026468 Delivering to channel: MAIL_RECV
    2005-06-12 22:27:06 Success SAPEngine_Application_Thread[impl:3]_34 1118608026468 Mail: message entering the adapter
    2005-06-12 22:27:06 Error SAPEngine_Application_Thread[impl:3]_34 1118608026828 Exception caught by adapter framework: Failed to call the endpoint
    2005-06-12 22:27:06 Error SAPEngine_Application_Thread[impl:3]_34 1118608026828 Delivery of the message to the application using connection AFW failed, due to: Failed to call the endpoint.
    2005-06-12 22:27:06 Success SAPEngine_Application_Thread[impl:3]_34 1118608026843 The asynchronous message was successfully scheduled to be delivered at Sun Jun 12 22:32:06 CEST 2005.
    2005-06-12 22:27:06 Success SAPEngine_Application_Thread[impl:3]_34 1118608026859 The message status set to WAIT.
    2005-06-12 22:32:07 Success SAPEngine_Application_Thread[impl:3]_34 1118608327109 The message was successfully retrieved from the receive queue.
    2005-06-12 22:32:07 Success SAPEngine_Application_Thread[impl:3]_34 1118608327125 The message status set to DLNG.
    2005-06-12 22:32:07 Success SAPEngine_Application_Thread[impl:3]_34 1118608327156 Delivering to channel: MAIL_RECV
    2005-06-12 22:32:07 Success SAPEngine_Application_Thread[impl:3]_34 1118608327171 Mail: message entering the adapter
    2005-06-12 22:32:07 Error SAPEngine_Application_Thread[impl:3]_34 1118608327250 Exception caught by adapter framework: Failed to call the endpoint 
    2005-06-12 22:32:07 Error SAPEngine_Application_Thread[impl:3]_34 1118608327250 Delivery of the message to the application using connection AFW failed, due to: Failed to call the endpoint .
    2005-06-12 22:32:07 Success SAPEngine_Application_Thread[impl:3]_34 1118608327281 The asynchronous message was successfully scheduled to be delivered at Sun Jun 12 22:37:07 CEST 2005.
    2005-06-12 22:32:07 Success SAPEngine_Application_Thread[impl:3]_34 1118608327296 The message status set to WAIT.
    2005-06-12 22:37:07 Success SAPEngine_Application_Thread[impl:3]_34 1118608627421 The message was successfully retrieved from the receive queue.
    2005-06-12 22:37:07 Success SAPEngine_Application_Thread[impl:3]_34 1118608627437 The message status set to DLNG.
    2005-06-12 22:37:07 Success SAPEngine_Application_Thread[impl:3]_34 1118608627546 Delivering to channel: MAIL_RECV
    2005-06-12 22:37:07 Success SAPEngine_Application_Thread[impl:3]_34 1118608627562 Mail: message entering the adapter
    2005-06-12 22:37:07 Error SAPEngine_Application_Thread[impl:3]_34 1118608627671 Exception caught by adapter framework: Failed to call the endpoint 
    2005-06-12 22:37:07 Error SAPEngine_Application_Thread[impl:3]_34 1118608627671 Delivery of the message to the application using connection AFW failed, due to: Failed to call the endpoint .
    2005-06-12 22:37:07 Success SAPEngine_Application_Thread[impl:3]_34 1118608627703 The asynchronous message was successfully scheduled to be delivered at Sun Jun 12 22:42:07 CEST 2005.
    2005-06-12 22:37:07 Success SAPEngine_Application_Thread[impl:3]_34 1118608627734 The message status set to WAIT.
    2005-06-12 22:42:07 Success SAPEngine_Application_Thread[impl:3]_40 1118608927734 The message was successfully retrieved from the receive queue.
    2005-06-12 22:42:07 Success SAPEngine_Application_Thread[impl:3]_40 1118608927734 The message status set to DLNG.
    2005-06-12 22:42:07 Success SAPEngine_Application_Thread[impl:3]_40 1118608927750 Delivering to channel: MAIL_RECV
    2005-06-12 22:42:07 Success SAPEngine_Application_Thread[impl:3]_40 1118608927750 Mail: message entering the adapter
    2005-06-12 22:42:07 Error SAPEngine_Application_Thread[impl:3]_40 1118608927765 Exception caught by adapter framework: Failed to call the endpoint 
    2005-06-12 22:42:07 Error SAPEngine_Application_Thread[impl:3]_40 1118608927781 Delivery of the message to the application using connection AFW failed, due to: Failed to call the endpoint .
    2005-06-12 22:42:07 Error SAPEngine_Application_Thread[impl:3]_40 1118608927796 The message status set to NDLV.
           Total: 33 Entries   1020304050 messages displayed per page; this is page 1 of  1 page(s)     

  • 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);

  • Mail-Adapter adds ".bin" to filename of attachment

    Hi!
    I'm sending mails with a dynamic generated filename using the mail-adapter and mail-package. The file extension of the attachment should be ".txt" and the content-type should be "application/EDIFACT"
    When I change the content-type of the attachment in my adapter module by
    TextPayload attachment = msg.createTextPayload();
    attachment.setName("something_dynamically_generated.txt");
    attachment.setContentType("application/EDIFACT");
    The content-type is changed properly, but the file extension ".bin" is added.
    The result is in my example:
    something_dynamically_generated.txt.bin
    How can I stop XI from extending my filename?
    I tried with the MessageTransformBean, but it had no effect.
    Best regards,
    Daniel

    Hi Sudharshan,
    we upgraded from SP15 to SP18, then the problem occured no more.
    I created the attachment in an adapter-module for the mail adapter. Sample code:
    TextPayload attachment = msg.createTextPayload();
    attachment.setContentType("Application/EDIFACT");
    attachment.setName("SomethingDynamicallyGenerated.txt");
    attachment.setText(string_which_contains_the_new_payload);
    msg.addAttachment(attachment);
    It seems that the mail adapter checks now if a filename extension is given. If this is the case, it adds no extension by itself.
    I tested different configurations like mail package and variable transportbinding / adapterspecific attributes, it worked every time.
    Best regards,
    Daniel

Maybe you are looking for