Different Attachment extension(.xls,.txt) in sender mail adapter

Hi Experts
Is it possible to use different type of attachment extension (e.g .xls,.txt) in the sender mail adapter?
My requirement is , the attachment in the mail adapter will be used as the main payload.So I am using PayloadSwapBean adapter module.
Currently I am using the following module key for .xls attachment and it is working.Configuration for .xls attachment is as follows
swap.keyName-Content-Disposition
swap.keyname-Content-Description
swap.keyName-Content-Type
swap.keyValue-attachment;filename="MailAttachment-1.xls"
swap.keyValue-MailAttachment-1
swap.keyValue-application/vnd.ms-excel.
Now, the attachment may be .xls or .txt file.
Now If I want to use .txt atachment then do I need to define all these parameter again and in that case what will be my content type for .txt file.
Your inputs required
thanks
Ayan

PayloadSwapBean  will only convert the attachment as the main payload.
Yeah for reading excel file I have a separate custom adapter module.This is not in the scope of my question..
All I am asking , can .txt as well as .xls attachment be used in the same sender mail adapter.
If that is possible what will be my content-type for .txt or can I remove content-type and use only content-disposition and content-description so that any type of attachment it can recognise.
The momment I am specifying  content-type , I am making it particular  that only say .xls attachment , it will identify.
I hope I make you clear.Inputs required
Thanks
Ayan

Similar Messages

  • Sender Mail Adapter - default interface name

    Hi,
    I need to receive through one e-mail sender channel tree different kind of messages.
    In sender mail adapter I specify ecept other parameters "Default Interface Name". When I send a message with a same as defined in an interface the message is processed correctly.
    But when I send a different kind of message then I get an error : "Receiver could not be determined".
    Is any way around how through one sender e-mail adapter receive a different kinds of messages ?
    Thanks for any help,
    Marian

    Hello Marzian,
    have you find a solution for this problem?
    We're facing the same issue.
    thanks,
    -Peter Ha

  • Sender mail adapter - filter emails by attachment?

    Dear experts,
    I have a sender mail adapter that picks an XSL (EXCEL) attachment from an incoming email and converts it (with a custom adapter module) to XML.
    But now how can I make the adapter only process emails with XLS - attachments? In that Inbox I also have emails with HTML-attachments for example. And now my adapter also wants to process those messages.
    In my adapter module that makes XLS to XML I see an exception in RWB but the message still gets through to SXMB_MONI where it gets stuck with a red flag.
    Can I somehow tell the adapter to only process emails with XLS attachments?
    Or can I stop the processing in the adapter module that converts XLS to XML?
    Thank you for any input or ideas on this!
    Best regards,
    Peter
    PS: I am using this code to convert XLS to XML:
    http://wiki.sdn.sap.com/wiki/display/ABAP/AdapterModuleToReadExcelFilewithMultipleRowsandMultiple+Columns

    Hello ChizzT,
    Thank you for your idea. I went with this one and it worked.
    Best regards,
    Peter

  • Sender Mail Adapter Attachment

    Hi All
    The mail I get from the 3rd party has a body and attachment. I have done the TRANSORM module as described in some of the forums, and then the Plain2XML.
    On sxmb_moni I see the MailMessage and MailAttachment-1, where the MailMessage is in XML format and MailAttachment in normal text. What should I do to completely ignore the MailMessage(body of the mail) and just send MailAttachment to the receiver.
    I have tried to split the message to two receivers, but because the attachment message does not transform to xml, it gives me a mapping error. Is there anyway I can either ignore the body and just send the attachment to the receiver without doing JAVA code.
    Thanks in advance
    Clinton

    Hi Jin
    Thanks for your answer.
    This is how I am using the module within the Sender Mail Adapter.
    localejbs/AF_Modules/PayloadSwapBean           TRANSFORM
    localejbs/AF_Modules/MessageTransformBean     Plain2XML
    TRANSFORM     swap.keyName     Content-Description
    TRANSFORM     swap.keyName     Content-Disposition
    TRANSFORM     swap.keyValue     attachment;filename="MailAttachment-1.xml"
    TRANSFORM     swap.keyValue     MailAttachment-1.xml
    Plain2XML     Transform.Class          com.sap.aii.messaging.adapter.Conversion
    Plain2XML     Transform.ContentType     text/xml;charset=utf-8
    Plain2XML     xml.conversionType     SimplePlain2XML
    Plain2XML     xml.documentName     MT_TEBA_Contractor_Details
    Plain2XML     xml.documentNamespace     http://lonmin.co.za/TEBA_to_SAP
    Plain2XML     xml.fieldNames          ENG_TYPE,INDUST_NO,COMPANY_NUMBER,SURNAME,INITIALS,NAME,REGISTERED,MALE,EXPERIENCE,RACE,MARITAL,DEPENDENTS,BIRTH_DATE,LANGUAGE,EDUCATION,SPOUSE,RELIGION,OFFICE,SERIAL_NO,REG_YEAR,SERV_START,SERV_EXPIRE,SERV_PER,LAST_CHANGE_DATE,LAST_CHNAGE_TIME,ID_DOC,ID_EFF_DATE,ID_EXP_DATE,PASSPORT,PASS_EFF_DATE,PASS_EXP_DATE,COUNTRY,DISTRICT,ADDR1,ADDR2,ADDR3,POSTCODE,PHONE,BI_1733_NO,REASON
    Plain2XML     xml.fieldSeparator     |
    Plain2XML     xml.processFieldNames     fromConfiguration
    Plain2XML     xml.structureTitle     Details
    Using it like this it does not do the swap correct and it still put the data within the body as xml, and leave the attachment as txt.
    Can you see something wrong here.
    Thanks
    Clinton

  • 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.

  • Sender Mail adapter configuration with attachment

    Hi,
    I read the below blog regarding the mail adapter
    /people/michal.krawczyk2/blog/2005/12/18/xi-sender-mail-adapter--payloadswapbean--step-by-step
    I have the same requirement but the attachment file is not an XML, it is CSV file so in the module tab if I change like below is it enough?
    TRANSFORM    swap.keyValue  attachment; filename=u201DMailAttachment-1.csvu201D     (I think MailAttachment-1 is the file name, am I correct?)
    If I change like above is it ok? or any other thing is required, Could you please give me the inputs
    Thanks
    Ramesh

    I have the same requirement but the attachment file is not an XML, it is CSV file so in the module tab if I change like below is
    it enough?
    PayloadSwapBean will ensure that the input to the mapping is from the attachment.....in the blog the attachment is in XML format and hence there was no need for any conversion.....yours is however a CSV file so you need to convert it to XML first and then do the further processing.....you can either use the MessageTransformationBean as shown in this blog:
    /people/gabrielsagayaselvam.panneerselvam/blog/2009/08/31/solve-key-field-problem-using-structplain2xml-in-messagetransformationbean
    Or write your own module code for the conversion.
    Regards,
    Abhishek.

  • Using header paramter SHeaderX-MS-HAS-ATTACH  in Sender mail adapter

    I am trying to check if an e-mail contains attachment in reciever determintion
    I set the Variable Header XHeaderName1 to be SHeaderX-MS-HAS-ATTACH
    in Sender mail adapter
    I added a condition in the receving determintation
    XHeaderName1 = yes
    I see the DynamicConfiguration tab in sxmb_moni and the value of SHeaderX-MS-HAS-ATTACH is "yes"
    but the message fails with the error
    No receiver could be determined
    any ideas?

    Hi,
    In Receiver determination you need to set SHeaderX-MS-HAS-ATTACH = yes instead of XHeaderName1.
    As far my understanding, in receiver determination you need to verify the condition with  SHeaderX-MS-HAS-ATTACH = yes (check with syntax also ie. case sensitive and all)
    Thanks
    Swarup

  • Dynamic file name of the attachment in sender mail adapter

    Hi
    I have configured a sender mail adapter which receives some attachments.
    Right now the file name of the attachment is hardcoded to "MailAttachment-1" "MailAttachment-2" using the content-description from "AF_Modules/PayloadSwapBean" module.
    I want to set it to dynamic ie. instead of "MailAttachment-1"... i want it with real name of the attach.
    please suggest a solution w/o the need to develop a custom adapter module.
    Thanks!
    Regards,
    Mariano.

    Thanks Prateek,
    Now, i can see that the name of the original file is into the content type named as  text/xml; name"name of the file.xml" when i send the email from outlook.
    If i send it from hotmail, this is not happend.
    Do you know why happend this?
    If i always would have the original name inside the content type, my problem will be solved.
    Edited by: Mariano Vidal on Feb 13, 2009 2:26 PM

  • How to download / read  text attachment  in Sender Mail Adapter  IN XI

    Hi
    I would like to know how to download / read text attachment in sender mail Adapter & sent same attachment to target system using file adapter.
    Please help how to design / resolve this concept.
    Regards
    DSR

    I would like to know how to download / read text attachment in sender mail Adapter & sent same
    attachment to target system using file adapter.
    Take help from this blog:
    /people/michal.krawczyk2/blog/2005/12/18/xi-sender-mail-adapter--payloadswapbean--step-by-step
    From the blog:
    However in most cases
    our message will not be a part of the e-mail's payload but will be sent as a file attachment.
    Can XI's mail adapter handle such scenarios? Sure it can but with a little help
    from the PayloadSwapBean adapter module
    Once your message (attachment) is read by the sender CC, you can perform the basic mapping requirement (if any) to convert the mail message fromat to the file format.....configure a receiver FILE CC and send the message...this should be the design...
    Regards,
    Abhishek.

  • Non XML attachment to XML in sender mail adapter

    Hi,
    I am working with sender mail adapter and usng payloadswapbean. My attachment is non XML and I need to convert it in to XML in order to mapping. How can I do that? Can someone explain if can I use MessageTransformBean for this purpose and if so, how?
    Or any other method for doing this?
    Thanks,
    Rakesh

    Is the attachment in text format? If yes, then after the usage of PayloadSwapBean, you may try using MessageTransformBean in the same module chain. And you will be able to convert it into xml format.
    Regards,
    Prateek

  • Email attachment name in sender mail adapter to the receiver file adapter

    HI ,
    Ths is regarding email to file scenario. I am trying to create file (in rceiver file adapter) with the same name as the email attachment that i read from mail sender adapter. I want ro use adapter module for this. I could find from blogs that there is module - GetAttachmentName - available that i can use for this in sender mail adapter.
    Can you please let me know what whetehr i neeed to mention any module key and parameters for this.
    I assume , i need to do following steps :Please confirm.
    1. i can use this module - after payload swap module and before standard mail adapter module in sender mail adapter
    2. select ASMA option in advanced tab in sender mail adapter
    3. In receiver file adapter select ASMA option in advanced tab in sender mail adapter
    4. Also select file name option in ASMA in sender mail adapter
    Thanks,
    Vamsi

    Hi Vamsi,
    your scenario is also described here: Re: sender mail adapter - attachment name
    If you use the Module getAttachmentName, which is described here,
    http://wiki.sdn.sap.com/wiki/display/XI/AdapterModulePI7.0GetAttachmentName
    your scenario should work as you described it.
    You just need to make sure that the Attachment Name that you read in the first place, is mapped to the Filename Attribute of the
    Fileadapter (http://sap.com/xi/XI/System/File/FileName).
    regards,
    Daniel

  • Rename the  attachment  of the Sender mail adapter

    Hello Everyone,
    i have Mail to file scenario. There is an  attachment in mail and this file needs to be renamed and dropped in FTP server. 
    is it possible to read the attachment and then rename it .
    How to achieve this solution because i could not find ASMA in sender mail adapter . so could not use Dynamic configuration.
    Regards,
    Ravi
    Edited by: Ravi Maheshwari on Feb 16, 2012 1:50 PM

    This blog could help you
    http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/6107

  • Sender mail adapter - attachment name

    Hi there
    We have configured a sender email adapter to receive text/csv attachments and save them to a file system. What we are having a problem with is reading the attachment name. So we are using Dynamis Configuration to create the file name using the subject line - Which is not ideal. Ideally we would like to use the same name as the origianl attachment but haven't found any way of doing that. We even tried using Content-type in the Variable Header (XHeaderName1) suing variable transport binding but it doesn't show up in the Dynamic Config part of the SOAP message.
    Is there any way of reading the name of the file attachment? We are on PI release 7.0.
    Any help would be appreciated.
    Cheers
    Salil

    Hi Vitor
    There are 2 scenarios that I can think of -
    1. You are saving the email attachment as a file. In that case use step 3 in the earlier reply to get the attachment name and save the file witht that name.
    2. You are sending the XML straight to a receiver using HTTP, IDOC, JDBC etc. in which case you would need the attachment name much earlier that step 3. For that I guess you would have to write another adapter module on the sender mail adapter(at Position 3 where position1 = payloadswap bean, 2 = custom module to get the attachment name) and add an xml tag to your incoming message. These adapter modules are really powerful and are like user exits in ABAP. In that case you would have to change the Data Type in the Integration repository to reflect that extra tag. Here is some code from a module we wrote to totally change the structure of the xml coming in. The key thing to remember is this module is that you can read the whole message byte by byte. There might be smarter ways of doing it (like using the SAP XML parser factory class) but since I'm not a Java programmer I stuck to the basics. Here's the code( you could also look at the example given in sap help where they remove (or add I'm not sure) CR(carriage return) from CRLF (CR Line feed).
    Created on Aug 8, 2007
    To change the template for this generated file go to
    Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
    package jdbcPackage;
    import javax.ejb.CreateException;
    import javax.ejb.SessionBean;
    import javax.ejb.SessionContext;
    import com.sap.aii.af.mp.module.*;
    import com.sap.aii.af.ra.ms.api.*;
    @author Salil.Mehta Soltius NZ Ltd
    To change the template for this generated type comment go to
    Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
    public class jdbcClass implements SessionBean, Module {
         private SessionContext myContext;
         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 {
              //        put your code here
              try {
                   Message msg = (Message) inputModuleData.getPrincipalData();
                   XMLPayload payload = msg.getDocument();
                   String payEnc = payload.getEncoding();
                   byte[] payByte = payload.getContent();
                   byte[] payByteOut = new byte[payByte.length];
                   byte[] payByteTemp = new byte[payByte.length];
                   int i;
                   int j;
                   int actualCount = 0;
                   char xmlTagFound = ' ';
                   char endXmlTagFound = ' ';
                   char tagFound = ' ';
                   System.arraycopy(payByte, 0, payByteTemp, 0, payByte.length);
                   // Step 1 - Conversions 
                   // convert   "&lt; to <"    and     "&gt; to >"
                   // convert   &quot; to "
                   // This will remove any carriage returns and line feeds
                   // and the <XML* and </XML* tags plus the <row> and </row> tags
                   for (i = 0; i < payByte.length; i++) {
                        // convert   &lt; to <    and     &gt; to >
                        if (payByteTemp<i> == '&') {
                             if (payByteTemp[i + 1] == 'l') {
                                  if (payByteTemp[i + 2] == 't') {
                                       if (payByteTemp[i + 3] == ';') {
                                            payByteTemp<i> = '<';
                                            payByteTemp[i + 1] = '\n';
                                            payByteTemp[i + 2] = '\n';
                                            payByteTemp[i + 3] = '\n';
                        if (payByteTemp<i> == '&') {
                             if (payByteTemp[i + 1] == 'g') {
                                  if (payByteTemp[i + 2] == 't') {
                                       if (payByteTemp[i + 3] == ';') {
                                            payByteTemp<i> = '>';
                                            payByteTemp[i + 1] = '\n';
                                            payByteTemp[i + 2] = '\n';
                                            payByteTemp[i + 3] = '\n';
                        if (payByteTemp<i> == '&') {
                             if (payByteTemp[i + 1] == 'q') {
                                  if (payByteTemp[i + 2] == 'u') {
                                       if (payByteTemp[i + 3] == 'o') {
                                            if (payByteTemp[i + 4] == 't') {
                                                 if (payByteTemp[i + 5] == ';') {
                                                      payByteTemp<i> = '"';
                                                      payByteTemp[i + 1] = '\n';
                                                      payByteTemp[i + 2] = '\n';
                                                      payByteTemp[i + 3] = '\n';
                                                      payByteTemp[i + 4] = '\n';
                                                      payByteTemp[i + 5] = '\n';
                        // This will take in the initial xml declaration from the Byte array
                        // And we also don't want the stuff after the xml declaration till
                        // we reach the first <row> tag     
                        if (xmlTagFound == ' ') {
                             if (payByteTemp<i> == '>') {
                                  xmlTagFound = 'X';
                             payByteOut[actualCount++] = payByteTemp<i>;
                             if (xmlTagFound == 'X') {
                                  payByteOut[actualCount++] = '\r';
                             continue;
                        if (xmlTagFound == 'X') {
                             if (payByteTemp<i> == '<') {
                                  if (payByteTemp[i + 1] == 'r') {
                                       if (payByteTemp[i + 2] == 'o') {
                                            if (payByteTemp[i + 3] == 'w') {
                                                 if (payByteTemp[i + 4] == '>') {
                                                      xmlTagFound = 'Y';
                                                 } else {
                                                      continue;
                                            } else {
                                                 continue;
                                       } else {
                                            continue;
                                  } else {
                                       continue;
                             } else {
                                  continue;
                        // Carriage return and line feed
                        if ((payByteTemp<i> == '\r') || (payByteTemp<i> == '\n')) {
                             continue;
                        // <XML_*> tag
                        if (payByteTemp<i> == '<') {
                             if (payByteTemp[i + 1] == 'X') {
                                  if (payByteTemp[i + 2] == 'M') {
                                       if (payByteTemp[i + 3] == 'L') {
                                            tagFound = 'X';
                                            endXmlTagFound = ' ';
                                            continue;
                        // </XML_*> tag
                        if (payByteTemp<i> == '<') {
                             if (payByteTemp[i + 1] == '/') {
                                  if (payByteTemp[i + 2] == 'X') {
                                       if (payByteTemp[i + 3] == 'M') {
                                            if (payByteTemp[i + 4] == 'L') {
                                                 tagFound = 'X';
                                                 endXmlTagFound = 'X';
                                                 continue;
                        // <row> tag
                        if (payByteTemp<i> == '<') {
                             if (payByteTemp[i + 1] == 'r') {
                                  if (payByteTemp[i + 2] == 'o') {
                                       if (payByteTemp[i + 3] == 'w') {
                                            if (payByteTemp[i + 4] == '>') {
                                                 tagFound = 'X';
                                                 continue;
                        // </row> tag
                        if (payByteTemp<i> == '<') {
                             if (payByteTemp[i + 1] == '/') {
                                  if (payByteTemp[i + 2] == 'r') {
                                       if (payByteTemp[i + 3] == 'o') {
                                            if (payByteTemp[i + 4] == 'w') {
                                                 if (payByteTemp[i + 5] == '>') {
                                                      tagFound = 'X';
                                                      continue;
                        if ((payByteTemp<i> == '>') && (tagFound == 'X')) {
                             tagFound = ' ';
                             continue;
                        if (tagFound == ' ') {
                             if (endXmlTagFound == 'X') {
                                  continue;
                             payByteOut[actualCount++] = payByteTemp<i>;
                   byte[] payByteExp = new byte[actualCount];
                   System.arraycopy(payByteOut, 0, payByteExp, 0, actualCount);
                   payload.setContent(payByteExp);
                   msg.setDocument(payload);
                   inputModuleData.setPrincipalData(msg);
              } catch (Exception e) {
                   ModuleException me = new ModuleException(e);
                   throw me;
              return inputModuleData;

  • XI - Sender mail adapter - attachment as payload

    Hi,
    My scenario is Email -> XI-> ...
    I am trying to send an email with an attachment. I want to XI process only the attachment as the payload.
    How do I do ? What is the communication channel configuration ?
    Thanks,
    Nicolas.

    Hi Nicolas,
    just have a look at my weblog:
    /people/michal.krawczyk2/blog/2005/12/18/xi-sender-mail-adapter--payloadswapbean--step-by-step
    it describes step by step what you want;)
    Regards,
    michal

Maybe you are looking for