Sending Flat file as an Email Attachment

Hi,
I have configured Mail Adapter to send XML Payload as an attachment .
But now i need to send Flat file as an attachment using Mail Adpater . Can any body help me out in this regard

Hi Vinay,
Yes , steps will same as earlier, use the blog i provided you.
*Configuring the Receiver Mail Adapter*
For outgoing mails, you need SMTP or IMAP4 access to your mail server. To access the mail server, enter the following URL:
smtp://YourServer or imap://YourServer/YourInbox
By selecting the Use Mail Package checkbox, you can include additional information to the XI message payload, that is, the mail sender.
If the mail has a plain-text format, you can select the Use Mail Package checkbox to convert the mail message to XML.
Working with Mail Packages
You can dynamically set the sender, receiver, and mail title by using the mail package format. When the mail package format is used, your structure of the payload must adhere to the structure of the mail package.
You can create the mail package structure using the graphical mapping tool. The XSD of the mail package is provided as an attachment in SAP Note 748024.
Creating a Mail Package with XSLT Mapping
If you want to determine the mail receiver dynamically from a payload field, but want the
payload to be sent unchanged, sometimes it is too complicated to use the graphical
mapping tool to create the mapping. The following figure provides an XSLT example that you can use, if your original payload provides the tags sender, receiver, and subject. The XSLT will set these values and copy the whole payload to the Content tag. The original payload will be the mail body.
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="xml" indent="yes" />
<xsl:template match="*">
<ns:Mail xmlns:ns="http://sap.com/xi/XI/Mail/30">
<Subject><xsl:value-of select="//subject"/></Subject>
<From><xsl:value-of select="//sender"/></From>
<To><xsl:value-of select="//receiver"/></To>
<Content><xsl:copy-of select="/"/></Content>
</ns:Mail>
</xsl:template>
</xsl:stylesheet>
When you use the MessageTransformBean module in the module processor
configuration of the communication channel, you can directly apply the XSLT mapping to the adapter module.
Enter localejbs/AF_Modules/MessageTransformBean as the first module. Select
the Type Local Enterprise Bean and select a value for Module Key.
You can also use the XSLT file for an interface mapping in the Integration Repository.
Changing the Name and Type of the Payload
By default, the payload of the XI message is sent as an attachment. If you use mail
package, the mail text in the Content tag is sent as a mail body (inline). If you want to change this or influence the name of the attachment, you can do this using the
MessageTransformBean module.
Enter localejbs/AF_Modules/MessageTransformBean as the first module.
Select the Type Local Enterprise Bean and select a value for Module Key.
If you use the Mail Package, then you have to apply the Mime type in the tag
Content_Type:
<ns:Mail xmlns:ns="http://sap.com/xi/XI/Mail/30">
<Subject>Hello</Subject>
<From>[email protected]</From>
<To>[email protected]</To>
<Content>This is a mail</Content>
<Content_Type>text/plain; charset="ISO-8859-1";
name="MyFile.xml"</Content_Type>
</ns:Mail>
Exactly how the mail content is displayed at the receiver end depends on the mail client. If the customer has a different mailing system, the mail look may look different at the customer side.
*_Sending a Mail with Attachment  (That is what you need)_*
If you want to send a mail with a body and attachment, or with several attachments, the message sender has to provide an XI message with additional attachments. For each additional payload of the XI message, the mail adapter creates an attachment for the mail. To enable this feature, you select the Keep Attachments checkbox when configuring the mail adapter. By default, the payload of the message is also sent as an attachment. If you do not want the payload to be sent as an attachment, set ContentDisposition to inline. If you want to give each attachment a certain name, you can use the swap module. The swap module changes the main payload.
Enter the localejbs/AF_Modules/PayloadSwapBean module as Local
Enterprise Bean between the two modules that change the attachment names.
Select a value for Module Key.
You can find the name of the payload that you want to set as the main payload in the XI message monitor (SXMB_MONI).
Useful SAP Notes
SAP Note 748024: Here you can download the XSD structure of the Mail Package.
SAP Note 794943: Description of the module “PayloadSwapBean”
SAP Note 793922: Description of the module
Hope this will help you.
Regards
Aashish Sinha
PS : reward points if helpful

Similar Messages

  • How to send text file as an email attachment havin more than 255 characters

    My requirement is to generate a text file and to send this text file as E-mail attachment. I am using FM 'SO_NEW_DOCUMENT_ATT_SEND_API1' to send the E-mail. but here the limitation is the number of characters per line must not be more than 255 characters whereas in my case it is exceeding 1000 characters per line. could anyone please suggest me what should i do now ? Each field in the text file has to be tab delimited.

    Simplest might well be to use javamail API instead of the two tags that Sites provides, e.g. see email - Sending mail attachment using Java - Stack Overflow for a full example.
    Phil

  • Sending DBF file as an email attachment

    Hi,
    I have a requirement to extract data from database table then send it as a DBF file in an external e-mail. By browsing the threads, i was able to create a DBF file using FM DOWNLOAD, I know this is obsolete but GUI_DOWNLOAD does not support DBF file type. This is currently stored in my local drive. This is working fine. I can view the file using FoxPro. My problem here is how to automatically send that DBF file in an email as an attachment.
    I learned that FM SO_DOCUMENT_SEND_API1 can be used but I think it doesn’t support a DBF filetype. I am receiving a message something like it is not a table when I open the file in FoxPro.
    Any help will be greatly appreciated. Thanks!

    Change in requirement. Only store DBF in the shared folder.
    Closing this thread.

  • Mail:send mail:attachment. Is there a simplest way to send a file as an email attachment ? or more correct ?

    <satellite:form  method="post" id="contact-form" enctype="multipart/form-data">
         <input type="file" name="adjunto" />
    </satellite:form>
    FTValList ftListaFichero = new FTValList(1);
    ftListaFichero.setValBLOB(ics.GetVar("adjunto_file"), ics.GetBin("adjunto"));
      <mail:send
           to="<%=to_emailaddress %>"
           from="<%=from_emailaddress%>"
           subject="Subject"
           body="<%=body %>" >
        <mail:attachment value='<%=ftListaFichero.getVal(ics.GetVar("adjunto_file"))%>'/>
      </mail:send>
    http://docs.oracle.com/cd/E29542_01/apirefs.1111/e39371/JSP/mail-attachment.html
    http://docs.oracle.com/cd/E29542_01/apirefs.1111/e39371/JSP/mail-send.html
    Regards,

    Simplest might well be to use javamail API instead of the two tags that Sites provides, e.g. see email - Sending mail attachment using Java - Stack Overflow for a full example.
    Phil

  • Starting yesterday I can scan a pdf file in from the scanner and can not send a pdf in an email attachment

    Starting yesterday I can scan a pdf file in from the scanner and can not send a pdf in an email attachment.  What happened?  Windows 8

    Adobe Reader can't scan documents. What software do you use?

  • Sending km document as an email attachment

    Hi all,
    I am trying to send a KM document as email attachment with the following peice of code. But I am getting FileNotFoundExceptio. Can anyone guide me as to where its going wrong. Any help will be appreciated.
    String filePath = "";
    ResourceContext ctx = new ResourceContext(getEP5User());
    RID rid = RID.getRID("/documents/LRForms/0000000054.pdf");
    IResource pdfResource =ResourceFactory.getInstance().getResource(rid, ctx);
    filePath =
         "irj\servlet\prt\portal\prtroot\com.sap.km.cm.docs\"
              + pdfResource.getRID().toString();
    Properties props = new Properties();
    props.put("mail.smtp.host", host);
    Session session = Session.getInstance(props, null);
    MimeMessage message = new MimeMessage(session);
    Address toAddress;
    Address fromAddress;
    Address ccAddress;
    Address bccAddress = new InternetAddress();
    MimeMultipart multipart = new MimeMultipart();
    BodyPart messageBodyPart = new MimeBodyPart();
    fromAddress = new InternetAddress("[email protected]");
    message.setFrom(fromAddress);
    toAddress = new InternetAddress("[email protected]");
    message.setRecipient(Message.RecipientType.TO, toAddress);
    message.setSubject("Subject");
    messageBodyPart.setText("Please find attached the details.");
    multipart.addBodyPart(messageBodyPart);
    messageBodyPart = new MimeBodyPart();
    DataSource source = new FileDataSource(filePath);
    messageBodyPart.setDataHandler(new DataHandler(source));
    messageBodyPart.setFileName(source.getName());
    messageBodyPart.setHeader("Content-Type", "application/pdf");
    multipart.addBodyPart(messageBodyPart);
    message.setContent(multipart);
    Transport.send(message);
    On executing this code I am getting following exception.
    MessagingException javax.mail.SendFailedException: Sending failed;  nested exception is: javax.mail.MessagingException: IOException while sending message;  nested exception is: java.io.FileNotFoundException
    Thanks and regards,
    Jaydeep

    Hi,
    Did you check permissions/security zone settings on the folder/file?
    Can you access the file directly from the browser?
    Regards,
    Omri

  • Last field has no value in sender flat file.....

    Hi,
    I am doing FCC on sender flat file.
    If the last field in the flat file has no value i.e. say if comma is my fiels seperator ,then the file is lik:
    1,2,3,
    The last node of my XML is not formed and giving me mapping errors....How do I solve dis??
    Plz help
    Edited by: sriparna1 on Oct 20, 2010 12:34 PM

    For comma seperated structures, the missing fiels are ignored.
    Make sure you defined the endseperator.
    Edited by: nagarjuna _s on Oct 20, 2010 12:46 PM

  • THROUGH HTTP CAN WE SEND FLAT FILE IN  PI7.3?

    Hi Experts,
    We have an requirement that Through HTTP can we send flat file in PI7.3.(For EX:source side HTTP and Target side is IDOC or PROXY)
    Can any one please suggest me how can I proceed for that?
    Please let me know if there is any Documents or Blogs are there related to above requirement...
    Thanks,
    Shaik

    Hi Shaik,
    You can try following approach might help.
    Tell the sender system to use post method for HTTP connection. In post method the particular application will hit to a URL and data will be passed. Source system should pass the data same as that of Text file. Use following link which will help you to convert the data sent as text into XML. Further you can use this XML to convert further into IDOC or proxy.
    Adapter User-Module for HTTP Adapter?

  • Cant open a pdf file as an email attachment

    I need help. I can't open a pdf file as an email attachment. It's like my computer doesn't think reader is installed. I can open an existing file through reader. I have deinstalled and reinstalled reader and am getting the same results.

    You can save the attachment and then open it.
    We can try to help but you haven't mentioned what you are using for your email...

  • Please help!!!!!! i filled out a job application using adobe reader but i cannot send the file back via email because the file is protected with a lock. how do i unlock this file to send it?!!!!!!!!!

    please help!!!!!! i filled out a job application using adobe reader but i cannot send the file back via email because the file is protected with a lock. how do i unlock this file to send it?!!!!!!!!!

    Hi kevinv1987,
    It doesn't sound like the PDF was password protected (or Adobe Reader would prompt you for a password). Instead, it sounds like that file may be marked locked by your operating system. Are you on Mac OS or Windows? In either case, here are instructions for removing the lock icon from the file:
    Remove the Lock Icon from a Folder in Windows 7 (check Microsoft's website if you have a different version of Windows)
    On Mac OS, select the file in the Finder, and choose File > Get Info. Then, just deselect the Lock checkbox.
    Please let us know how it goes.
    Best,
    Sara

  • Sending Flat File

    Hi Folks,
         I have a requirement of fetching a flat file from the non sap system to sap system and send flat file from sap system to non sap system. Can anybody help me how to achieve this ?
    Thanks & Regards,
      Santosh

    check if this helps for you
    text file from sap<->non-sap
    sending a file from the SAP app server to a network
    File from SAP R/3 to other Server
    Sending Data from R/3 to Java and Java to SAP
    Regards
    Kumar

  • Create end of file character in email attachment

    Hi all,
    Currently I am attaching a text file to the email send using FM 'SO_NEW_DOCUMENT_ATT_SEND_API1'.
    But here the issue is, in attachment file there are extra 3 blank lines are getting filled which client does't want.
    Is there any way to generate end of file character, to add after all rows got filled in internal table?
    Or is there any way to not to filled blank lines at the end of the file?
    Please advise a solution.
    Thanks and Regards
    Nishad

    Hi,
    gs_packinglist-doc_size =  gf_count * 255 .
    This is how I am passing the doc_size. In the above, gf_count is the number rows in attachment file that I am multiplying with 255 characters as I am passing attachment in contents_bin parameter.
    Thanks and regards
    Nishad

  • Pdf file sent via email attachment gets a webloc extension

    Someone sent an email with a pdf attachment to our entire school via our google mail account. People with PCs were able to open the pdf files. Mac users received the pdf files with a webloc extension (i.e. - filename.pdf.webloc) and were unable to open it. How did this happen and how can we prevent it from happening again? I had 2 of the pdf files on my mac (one of which I created) and they did not have a webloc extension. Any help would be great. Thank you!!

    Hi Kappy.
    I tried that and received a message from Adobe Acrobat that read "Adobe Reader could not open 'Absentee Ballot.pdf' because it is either not a supported file type or because the file has been damaged (for example, it was sent as an email attachment and wasn't correctly decoded).
    Since we have 300+ families who receive these emails and I don't know who has a mac and who doesn't I would rather be able to send the pdf attachments and prevent the webloc from being applied at all versus letting everyone know how to remove it once they receive it.
    Thanks for replying.
    Christina

  • Unable to send a file via my email client

    when i try to send a file via email i get the following error message : ' adobe reader could not  connect to e-mail client' - pl help.
    os; win 7 home premium[64-bit]; browser: ie9; e-mail client : hotmail & gmail

    That pretty much means you don't have an email client. This is something like Outlook Express you may have seen.
    Instead, open your email and attach the PDF.

  • How do I download a song file from an email attachment to my iPad?

    I have a song file in my email. I can hear it when I touch on it, but I want a way save it to my iPad music. I want to put it into my music so it's there on my iPad.

    Okay. This iPad is synced with my husband's iTunes. He's in California with his Mac, I'm here in New York. How do I save music from an email attachment onto the iPad.

Maybe you are looking for

  • How can i restore my shuffle if itunes cant even detect it????

    my ipod shuffle 4 is non responsive to any of the "r" trouble shooters (with the exception to restore because it is not detectable on itunes). ive bought new cables, checked usb, updated all windows and itunes, tried wall outlet charger, tried a diff

  • Monitor forms in oem

    When I try to monitor forms user sessions in OEM (10g) nothing is listed and an information message states em_mode in the default config is set to 0 and must be set to 1. This is not true as I have set em_mode=1 in both the default and my named confi

  • How can i boot to Live Linux disk in my MacBook OS 10.5.4

    i remember in Windows you restart your computer hold down F12 and select boot from DVD how do you do that on the MacBook ?

  • Purc.reqs&reservation

    How should i configurate in the IMG-project system-material-Procurement indicator for material components ,and Check acct asst categories and document types for purc.reqs,also network profile, so that i can get purc.reqs and reservation at the same t

  • Finding linked images

    Hi, I'm using InDesign CS 5.5 and I want to quickly find where my linked images are located in order to be able to easily replace them with another one. To do this, I use the links palette menu and the "lock-symbol". When doing so, the Search Window