Mail attachment in java

hi
Here is the code i am using for mail attachment without attachment it is working fine
package com.nihon.login;
import java.util.Properties;
import java.util.ResourceBundle;
import javax.activation.DataHandler;
import javax.activation.DataSource;
import javax.activation.FileDataSource;
import javax.mail.BodyPart;
import javax.mail.Message;
import javax.mail.Multipart;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeBodyPart;
import javax.mail.internet.MimeMessage;
import javax.mail.internet.MimeMultipart;
import javax.mail.util.ByteArrayDataSource;
public class Mail {
* @param args
private static String host = null;
private static String from = null;
private static String to = null;
private static String subject = null;
private static String content = null;
private static String filename = "D:\\Users
entry.pdf";
public static void send(String fromAddress,String toAddress,String subject, String mailContent) throws Exception{
send(fromAddress,toAddress,null,subject,mailContent);
public static void send(String fromAddress,String toAddress, String ccAddress,String subject, String mailContent) throws Exception {
ResourceBundle rb = ResourceBundle.getBundle("com.nihon.login.Application");
MailInfo mail = new MailInfo();
mail.setMailServer(rb.getString("nihon.mail.server"));
if(fromAddress!=null){
mail.setFromAddress(fromAddress);
}else{
mail.setFromAddress(rb.getString("nihon.mail.fromID"));
host = mail.getMailServer();
// Get system properties
Properties props = System.getProperties();
// Setup mail server
props.put("mail.smtp.host", host);
// Get session
Session session = Session.getDefaultInstance(props, null);
// Define message
MimeMessage message = new MimeMessage(session);
// Set the from address
message.setFrom(new InternetAddress(mail.getFromAddress()));
// Set the to address
if(toAddress!=null)
message.addRecipient(Message.RecipientType.TO, new InternetAddress(toAddress));
if(ccAddress!=null){
message.addRecipient(Message.RecipientType.CC, new InternetAddress(ccAddress));
// Set the subject
message.setSubject(subject);
// Set the content
message.setText(mailContent);
For attachment
BodyPart messageBodyPart = new MimeBodyPart();
Multipart multipart = new MimeMultipart();
multipart.addBodyPart(messageBodyPart);
messageBodyPart = new MimeBodyPart();
DataSource source = new FileDataSource(filename);
messageBodyPart.setDataHandler(new DataHandler(source));
messageBodyPart.setFileName(filename);
multipart.addBodyPart(messageBodyPart);
message.setContent(multipart);
// Send message
Transport.send(message);
// Method to instantiate once
public static Mail getInstance() {
if (instance == null) {
instance = new Mail();
return new Mail();
// Construtctor
protected Mail() {
private static Mail instance = null;
But now i add some code for attachment after that i got the exception in below
javax.mail.MessagingException: IOException while sending message;
nested exception is:
java.io.IOException: No content
at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:625)
at javax.mail.Transport.send0(Transport.java:169)
at javax.mail.Transport.send(Transport.java:98)
at com.nihon.login.Mail.send(Mail.java:104)
at com.nihon.login.Mail.send(Mail.java:47)
at com.nihon.login.Mailsender.sendMail(Mailsender.java:47)
at com.nihon.login.Mailsender.attributeAdded(Mailsender.java:19)
at org.apache.catalina.session.StandardSession.setAttribute(StandardSession.java:1334)
at org.apache.catalina.session.StandardSession.setAttribute(StandardSession.java:1243)
at org.apache.catalina.session.StandardSessionFacade.setAttribute(StandardSessionFacade.java:130)
at com.nihon.track.OnsitePlacement.doProcessRequest(OnsitePlacement.java:347)
at com.nihon.track.OnsitePlacement.doPost(OnsitePlacement.java:420)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685)
at java.lang.Thread.run(Unknown Source)
How can i solve this problem.
Thanks in advance.......

If the message is in an Exchange server, you can access it with JavaMail
and extract the attachment. See the JavaMail FAQ and the many sample
programs that come with JavaMail.
If the message is in Outlook's message store on your desktop machine,
it's harder. You need a JavaMail "message store provider" that understands
the message store format used by Outlook on your local disk. JavaMail
doesn't come with such a provider, but you might find one in the Third
Party Products list on the JavaMail web page.

Similar Messages

  • Extract Mail Attachment using Java Mail

    Hello Friends
    A day ago I entered into Java Mail , now I am able to send mail from my Java Program.
    The help I need from you is I wanna save the attachment coming in the mail using Java.
    For eg : a mail reched my Inbox contains .xls or .csv file which I wanna save to some place.
    Plss guide me to acheive this friends.
    Regards
    Vicky

    String host = "";
    String username = "";
    String password = "";
    String srcDir = "INBOX";
    String tarDir = "";
         String subject = "";
    String filepath = "C:/Documents and Settings/name/Desktop";
    String filename = "demo";
    Properties props = System.getProperties();
    props.put("mail.host", host);
    Session session = Session.getDefaultInstance(props, null);
    Store store = session.getStore("imap");
    store.connect(host, username, password);
    Folder folder = store.getFolder(srcDir);
              Folder dFolder = store.getFolder(tarDir);
    folder.open(Folder.READ_WRITE);
              Message message[] = folder.getMessages();
              java.util.Date yesterdayDate = new Date(System.currentTimeMillis() - 24*60*60*1000);
    for (int p = 0; p < message.length; p++) {
                   java.util.Date messageReceivedDate = message[p].getReceivedDate();
                   if(messageReceivedDate.after(yesterdayDate))
                        if (message[p].getSubject().equals(subject)) {
                             Multipart mp = (Multipart)(message[p].getContent());
                             for (int i = 0, n = mp.getCount(); i < n; i++) {
    Part part = mp.getBodyPart(i);
    String disposition = part.getDisposition();
    if ((disposition != null) && (disposition.equals("ATTACHMENT") || disposition.equals("INLINE")))) {
    String fullpath = filepath+"/" + filename+".csv";               
    File file = new File(fullpath);
    InputStream in = part.getInputStream();
    FileOutputStream fos = new FileOutputStream(file);
    byte[] buf = new byte[part.getSize()];
    int c = 0;
                             while ((c = in.read(buf)) != -1) {
    fos.write(buf, 0, c);
                                       in.close();
                                       fos.close();
                                  } // if (disposition) closing
                             }// inner for loop closing
    /* ----------------------------------------------------Move Message to new folder--------------------------------------------------------------------- */
    if (message.length != 0) {
    folder.copyMessages(message, dFolder);
    folder.setFlags(message, new Flags(Flags.Flag.DELETED), true);
    // Dump out the Flags of the moved messages, to insure that
    // all got deleted
    for (int i = 0; i < message.length; i++)
                                  if (!message.isSet(Flags.Flag.DELETED))
                                       System.out.println("Message # " + message[i] + " not deleted");
                             } //for
    }// if (message.length != 0)
    // System.out.println("*** Message moved to "+tarDir+" Directory ***");
                        }//if loop closing - checking message subject
                   }// if loop closing checking date
    }// outer for() loop closing

  • Problem in handling mail attachment by java in Microsoft outlook 2003

    I have written code in Java for extracting attachment files from mail message but the same code is working with Microsoft Outlook 2000 but not working with Microsoft Outlook 2003. need solution for this problem ASAP.It is failing in recognizing boundries of attachments.
    Mail API version :1.3.3_01
    Part part = mimemultipart.getBodyPart(i);
    String disposition = part.getDisposition();
    objStatement=objConnection.createStatement();
    if ((disposition != null) && (disposition.equals(Part.ATTACHMENT) || disposition.equals(Part.INLINE)))                System.out.println("****Attachement found****");
    rs=objStatement.executeQuery("select KNTA_ATTACHMENT_S.nextval from dual");
    while(rs.next())
    strAttachementId=rs.getString(1);
    System.out.println("Attachement id"+strAttachementId);          strFileName=part.getFileName();          System.out.println("file attach with the mail"+strFileName);     attachementDir=strAttachementId.substring (strAttachementId.length()-2,strAttachementId.length());
    System.out.println("Attachement dir"+attachementDir);     storedFileName=strAttachementId+"_"+part.getFileName();     System.out.println("Stored filename"+storedFileName);     OutputStream out=new FileOutputStream(strAttachmentPath+"/"+attachementDir+"/"+storedFileName);     InputStream in=part.getInputStream();          
    while ((len = in.read(buf)) > 0)
         {                           //System.out.println("content"+buf);
    out.write(buf, 0, len);
    in.close();
    out.close();
    Message was edited by:
    Vikas_Rathore_Patni

    Hi Vikas_Rathore_Patni
    I'm a student in Greece and I'm interested in the way this code of yours actually works. What i really want to do is to find a way of opening e-mail attachments and extracting them to a txt file. Are there any necessary tips for that ?
    I would really appreciate it if you could send me this code of yours in this mail :
    [email protected]
    Regards Marios

  • 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

  • Java Mapping: payload as mail attachment and dynamic file name .

    Hi,
    I have written this piece of java code.
    The code includes XPATH for fetching dynamic filename and the copysource( in, out ) to copy the content of payload as mail attchment.
    The code seems to work fine, when either of the functionality is implemented.
    but when both are implemented together ie parsing for xpath then again parsing to copy payload, then it doesnt executes the latter path i.e the payload is not fetched in the attachment.
    public class MailPackage implements StreamTransformation {
      public void setParameter(Map map) {
      public void execute(InputStream in, OutputStream out)
              throws StreamTransformationException {
      String mailSubject = "test mail";
      String mailSender = "aaaaaaaa";
      String mailReceiver = "[email protected]";
      String attachmentName = null;
      DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    DocumentBuilder builder = null;
      factory.setNamespaceAware(false);
    factory.setValidating(false);
         try {
              builder = factory.newDocumentBuilder();
         Document doc = null;
          doc = builder.parse(in);
              String XPATH ="/*/Invoice/InvoiceHeader/InvoiceNumber/text()";
              Node fieldValueNode = org.apache.xpath.XPathAPI.selectSingleNode(doc,XPATH);
              System.out.print(fieldValueNode);
              attachmentName = fieldValueNode.getNodeValue() +".xml";
      String boundary = "--";
      String mailContent = "This is a sample file";
      String CRLF = "\r\n";
        //     create XML structure of mail package
        String output ="<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
               + "<ns:Mail xmlns:ns=\"http://sap.com/xi/XI/Mail/30\">"
               + "<Subject>" + mailSubject     + "</Subject>"
               + "<From>" + mailSender     + "</From>"
               + "<To>" + mailReceiver     + "</To>"
               + "<Content_Type>multipart/mixed; boundary=\"" + boundary + "\"</Content_Type>"
               + "<Content>";
        out.write(output.getBytes());
        // create the declaration of the MIME parts
        //First part
        output = "--" + boundary + CRLF
               + "Content-Type: text/plain; charset=UTF-8" + CRLF
               + "Content-Disposition: inline" + CRLF + CRLF
               + mailContent + CRLF
        //Second part
        + "--" + boundary + CRLF
        + "Content-Type: application/xml; name=" + attachmentName + CRLF
        + "Content-Disposition: attachment; filename=" + attachmentName + CRLF + CRLF;
        out.write(output.getBytes());
        //Source is taken as attachment
        copySource(in, out);
        out.write("</Content></ns:Mail>".getBytes());
      } catch (Exception ie) {
        throw new StreamTransformationException(ie.getMessage());
    protected static void copySource(InputStream in, OutputStream out)throws IOException {
        byte[] bbuf = new byte[in.available()];
        int bblen = in.read(bbuf);
       if (!(bblen < 0)) {
          String sbuf = new String(bbuf);
           //replace all control characters with escape sequences
         sbuf = sbuf.replaceAll("&", "&amp;");
         sbuf = sbuf.replaceAll("\"", "&quot;");
         sbuf = sbuf.replaceAll("'", "&apos;");
        sbuf = sbuf.replaceAll("<", "&lt;");
        sbuf = sbuf.replaceAll(">", "&gt;");
        out.write(sbuf.getBytes());
    Povide your suggestions.

    Hi,
    This is the sample o/p that I get by opening the mail attachment using notepad.
    <?xml version="1.0" encoding="UTF-8"?>
    <InvoiceTransmission><InvoiceTransmissionHeader><InvoiceCreationDate>2008-12-03T00:00:00</InvoiceCreationDate><Version>2.0.2</Version></InvoiceTransmissionHeader><Invoice><InvoiceHeader><CustomerEntityID>LH</CustomerEntityID><IssuingEntityID>009140559</IssuingEntityID><InvoiceNumber>913353669</InvoiceNumber><InvoiceIssueDate>2008-12-03</InvoiceIssueDate><InvoiceType InvoiceTransactionType="OR">INV</InvoiceType><InvoiceDeliveryLocation>aaa</InvoiceDeliveryLocation><TaxInvoiceNumber>Not Applicable</TaxInvoiceNumber><InvoiceCurrencyCode>USD</InvoiceCurrencyCode><InvoiceTotalAmount>517174.63</InvoiceTotalAmount><InvoiceIDDetails InvoiceIDType="BT"><InvoiceIDVATRegistrationNumber>0000000000</InvoiceIDVATRegistrationNumber><InvoiceIDName1>aaaaaaaaaaaaaaa</InvoiceIDName1><InvoiceIDName2>bbbbbbHKG</InvoiceIDName2><InvoiceIDCity>ccccccccc ccccc</InvoiceIDCity><InvoiceIDCountryCode>HK</InvoiceIDCountryCode></InvoiceIDDetails><InvoiceIDDetails InvoiceIDType="II"><InvoiceIDVATRegistrationNumber>0000000000</InvoiceIDVATRegistrationNumber><InvoiceIDName1>eeeeeeee</InvoiceIDName1><InvoiceIDName2>PAY BY WIRE TRANSFER</InvoiceIDName2><InvoiceIDCity>fffffffffffffff, NA</InvoiceIDCity><InvoiceIDCustomField ID="1"><InvoiceIDCustomFieldDescription>Company Registration Number</InvoiceIDCustomFieldDescription><InvoiceIDCustomFieldValue>0000000000</InvoiceIDCustomFieldValue></InvoiceIDCustomField></InvoiceIDDetails></InvoiceHeader><SubInvoiceHeader><InvoiceLine><ItemNumber>001</ItemNumber><ItemQuantity><ItemQuantityType>IN</ItemQuantityType><ItemQuantityFlag>GR</ItemQuantityFlag><ItemQuantityQty>28134.000</ItemQuantityQty><ItemQuantityUOM>USG</ItemQuantityUOM></ItemQuantity><ItemQuantity><ItemQuantityType>DL</ItemQuantityType><ItemQuantityFlag>GR</ItemQuantityFlag><ItemQuantityQty>106498.775</ItemQuantityQty><ItemQuantityUOM>LT</ItemQuantityUOM></ItemQuantity><ItemDeliveryReferenceValue ItemDeliveryReferenceType="DTN">590365</ItemDeliveryReferenceValue><ItemDeliveryReferenceValue ItemDeliveryReferenceType="!
    ARN">DAL
    CH</ItemDeliveryReferenceValue><ItemDeliveryReferenceValue ItemDeliveryReferenceType="FNO">mmmmmmmmm</ItemDeliveryReferenceValue><ItemDeliveryLocation>pppp</ItemDeliveryLocation><ItemReferenceLocalDate
    If you notice the problem is, the undesired "exclamation mark" that gets added in some fields before the actual value.
    In the above case.. look at "ItemDeliveryReferenceType="! ARN">DAL"
    the exclamation mark before value "ARN is unwanted, which leads to improper XML formation.
    Cant figure out why is this coming.
    Regards,
    Faria Mithani

  • How to access MS Exchange Server Mail and download attachment using Java ??

    Hi guys,
    I need to develop a program to access my inbox from MS Exchange Server and also download the attachment using Java language !! Any example code or any site which got tutorial on this ? Thanks !!

    Here is a java file that connects to a users exchange account, reads all messages, and writes the attachment to the file system.
    import java.io.*;
    import java.util.*;
    import javax.mail.*;
    import javax.mail.internet.*;
    import javax.activation.*;
    public class TestNew {
    public static void main (String args[]) throws Exception {
    // Create empty properties
    Properties props = new Properties();
    // Get session
    Session session = Session.getInstance(props, null);
    // Get the store
    Store store = session.getStore("imap");
    // Connect to store
    store.connect(host, username, password);
    // Get folder
    Folder topFolder = store.getDefaultFolder();
    Folder folder = literature.getFolder("newFolder");
    folder.open(Folder.READ_WRITE);
    Message[] msg = folder.getMessages();
    for(int i = 0; i < msg.length; i++){
    Address[] from = msg.getFrom();
    String subject = msg[i].getSubject();
    Object o = msg[i].getContent();
    if (o instanceof MimeMultipart) { //attachements available?
    MimeMultipart mm = (MimeMultipart) o;
    int mmCount = mm.getCount();
    for (int m = 0; m < mmCount; m++) { // for each part
    Part part = mm.getBodyPart(m);
    String disposition = part.getDisposition();
    if ((disposition != null) && ((disposition.equals(Part.ATTACHMENT) || disposition.equals(Part.INLINE)))) {
    InputStream is = null;
    File tempFile = new File("D:\\TEMP\\mailtest\\" + part.getFileName());
    FileOutputStream fos = null;
    try {
    fos = new FileOutputStream(tempFile);
    is = part.getInputStream();
    int byteCount = 0;
    byte[] bytes = new byte[128];
    while ( (byteCount = is.read(bytes, 0, bytes.length)) > -1) { //use full read() method for GZIPInputStream to be treated correctly
    fos.write(bytes, 0, byteCount);
    finally {
    try {
    if (fos != null)
    fos.close();
    catch (IOException ioe) {}
    try {
    if (is != null)
    is.close();
    catch (IOException ioe) {}
    System.out.println("Content: " + o);
    System.out.println(from[0].toString());
    System.out.println(subject);

  • Mail attachment with UDF in SAP PI 7.1

    Hello,
    I need to reproduce this solution in PI 7.1
    /people/samuel.chandrasekaran2/blog/2008/10/06/xi-mail-adapter-dynamically-building-attachment-and-message-body-content-using-a-simple-udf
    It is about  adding lines of a message as an attachment to a mail.
    The UDF works for all elements except the lines for the attachment itself.
    In order to build the content of the attachment (for this particular requirement) they are using a global variable declared and initialized in the global sections.
    But the button for the Java Section to use an imported archive is no longer available in PI.....
    So how to solve that issue?
    I tried to use a graphical variable instead of a global variable but I have no idea how to add the n lines
    from the source message as one import object into the UDF via that graphical variable.
    Your ideas are very appreciated!
    Best Regards
    Dirk

    Hi,
    yes, it is a little bit different. This is the issue.....  
    But I am not sure if your links will help:
    1) /people/william.li/blog/2008/02/13/sap-pi-71-mapping-enhancements-series-using-graphical-variable
    is about a different solution. I do not need to count the number of lines of the source message.
    And the second variable is about concat line by line from unbound node to unbound node.
    My issue is:
    Souce:
    Message line (0...unbound) ! ! ! ! ! ! ! !
    .    ResultLine   (1..1)
    Mapping:
    =>   ResultLine1
           ResultLine2
           ResultLine........          => into UDF to an element  (1..1) in one mapping operation.
    So that all "ResultLine"s are included.
    The result is explained in the given link for Mail attachment with UDF.
    So I am not sure how to use this thread for my issue.
    In the comments of that blog Christoph Gerber writes that the new variable feature can only handle single values.
    So it is not suitable for my purposes as I have a list of values here that needs to be moved into the target message field.
    2) http://wiki.sdn.sap.com/wiki/display/Java/UsingEditJavaSectioninMessageMapping
    shows where to find the button "Java section" which is not available here in 7.1
    3) /people/sap.user72/blog/2005/10/01/xi-new-features-in-sp14
    too is about the nice little button for Java Section that is no longer existing on PI 7.1 screen for mappings.  
    So my issue is: How to replace the Java section function with global variables in PI 7.1?
    Best regards
    Dirk

  • How can I read mail attachment for making it to the payload?

    Hi everybody,
    in the following my scenario:
    I have an incoming message with attachment by the mail sender adapter using PayloadSwapBean (because of other messages I have to use the bean). I want to send this attachment by using the mail receiver adapter to fix E-mail-address keeping the FromMailAddress, the MailSubject and the FileName
    without the metadata as additional attachment.
    I have found a thread where it is explained how to handle "payload as mail attachment and dynamic filename" by java-mapping. So far so good. My question is: How can I make my attachment to be the payload? How can I read the attachment by java-mapping?
    Thanks for help.
    Reagrds,
    Sebastian Linke

    USe payloadSwapBean for this to swap your payload and attachment
    /people/michal.krawczyk2/blog/2005/12/18/xi-sender-mail-adapter--payloadswapbean--step-by-step
    Rajesh
    Edited by: Rajesh on Feb 5, 2009 5:29 PM

  • Mail Receiver Error:  java.lang.IllegalArgumentException: can't parse argum

    Hi everybody,
    I get the error in mail receiver CC:
    java.lang.IllegalArgumentException: can't parse argument number
    My Payload looks like this:
    <?xml version="1.0" encoding="utf-8" ?>
    - <ns1:Mail xmlns:ns1="http://sap.com/xi/XI/Mail/30">
      <Subject>The subject</Subject>
      <From>mailadress</From>
      <To>mailadress</To>
      <Content_Type>multipart/mixed; boundary="AaBb--984dfgeSSd3532"</Content_Type>
    - <Content_Description>
      <attachment filename="Filename.txt">content_of_attachment</attachment>
      </Content_Description>
      <Content_Disposition>attachment</Content_Disposition>
      <Content>Constant</Content>
      </ns1:Mail>
    Any ideas?
    Regards
    Mario

    Hi Mario..
    Go thru this thread for it.
    Error Catagory : XI_J2EE_ADAPTER_MAIL
    Regards

  • This is regarding CBMA in SAP PI 7.3.1. I have set up the alert mail using default java mail client.I do receive the alerts via mail. But my requirement is to direct all the mails to Business workplace inbox in ECC.

    This is regarding CBMA in single stack SAP PI 7.3.1. I have set up the alert mail using default java mail client.I do receive the alerts via mail. But my requirement is to direct all the alert mails to Business workplace inbox in ECC.
    So I need to set up PI to redirect mails to ECC Business workplace user inbox (sbwp). From here rules are set up & routed per distribution list.
    Please guide me how I can achieve this requirement.

    Hi,
    yes, it is a little bit different. This is the issue.....  
    But I am not sure if your links will help:
    1) /people/william.li/blog/2008/02/13/sap-pi-71-mapping-enhancements-series-using-graphical-variable
    is about a different solution. I do not need to count the number of lines of the source message.
    And the second variable is about concat line by line from unbound node to unbound node.
    My issue is:
    Souce:
    Message line (0...unbound) ! ! ! ! ! ! ! !
    .    ResultLine   (1..1)
    Mapping:
    =>   ResultLine1
           ResultLine2
           ResultLine........          => into UDF to an element  (1..1) in one mapping operation.
    So that all "ResultLine"s are included.
    The result is explained in the given link for Mail attachment with UDF.
    So I am not sure how to use this thread for my issue.
    In the comments of that blog Christoph Gerber writes that the new variable feature can only handle single values.
    So it is not suitable for my purposes as I have a list of values here that needs to be moved into the target message field.
    2) http://wiki.sdn.sap.com/wiki/display/Java/UsingEditJavaSectioninMessageMapping
    shows where to find the button "Java section" which is not available here in 7.1
    3) /people/sap.user72/blog/2005/10/01/xi-new-features-in-sp14
    too is about the nice little button for Java Section that is no longer existing on PI 7.1 screen for mappings.  
    So my issue is: How to replace the Java section function with global variables in PI 7.1?
    Best regards
    Dirk

  • Dynamic file name as mail attachment in receiver Mail Adapter?

    Hi,
    Can any one tell the possibility of attaching file as a mail attachment without using mail Package with dynamic filename.
    Business requirement is to send error response as mail attachment with dynamic name.
    Ex: Error_Response_20110802_13.24 where 20110802 is Date and next part represents time stamp.
    File attachment name should change dynamically in Mail receiver Adapter. Thanks
    Regards,
    Sreeramulu Konjeti.

    there is no standard way.
    you will have to write a module to get this in place.
    other ways are;
    XI Mail Adapter: An approach for sending emails with attachment with help of Java mapping - /people/stefan.grube/blog/2007/04/17/xi-mail-adapter-an-approach-for-sending-emails-with-attachment-with-help-of-java-mapping
    Dynamic name in the mail attachment - pseudo "variable substitution" :
    /people/michal.krawczyk2/blog/2006/02/23/xi-dynamic-name-in-the-mail-attachment--pseudo-variable-substitution

  • Sending XI-Content as Mail Attachement with specific Filename

    Hi,
    I want to send the Message-Content as a mail attachment with a specific Filename (e.g. 2005-08-31.csv). The content is a CSV File, not a XML
    In the scenario an IDOC is sent to the XI mapped in a CSV-File (via Java-Mapping) and should be send as a Mail Attachment.
    Is this possible and how?
    Thank you for your help
    Thomas

    Hi Thomas,
    You can influence the filename with the ModuleTransformBean. You need at least SP9 for this feature.
    In the Mail Receiver Channel got to tab "Module"
    As first module (before the mail module) enter:
    localejbs/AF_Modules/MessageTransformBean as Local Enterprise Bean with any key
    For this module key you can use in the module configuration following entries:
    Transform.ContentDisposition inline|attachment;filename=<filename>
    Transform.ContentDescription <Filename>
    Transform.ContentType <MimeType>/<SubType>;name="<filename>"
    If you want to send an attachment, use:
    Transform.ContentDisposition attachment;filename="MyFile.csv"
    Transform.ContentDescription MyFile
    Transform.ContentType text/plain;name="MyFile.csv"
    If you use the Mail Package, you can set the file name that way:
    <ns:Mail xmlns:ns="http://sap.com/xi/XI/Mail/30">
      <Subject>Hello</Subject>
      <From>[email protected]</From>
      <To>[email protected]</To>
      <Content_Type>text/plain;name="MyFile.csv"</Content_Type>
      <Content>Here comes the CSV Data</Content>
    </ns:Mail>
    Hope that helps,
    Stefan

  • Problem in Reading Mail Attachement

    I'm facing a problem while reading mail attachments. Java-mail returns null disposition for the below message,but this message has attachment javamail is not considering the mail attachment .I'm using java-mail 1.3.Can anybody help me to solve this problem ?
    Return-Path: prvs=00548bd8bd=[email protected]
    Received: from PRODTM1.TRUST.UASC.AO ([172.28.2.143])
         by trust.uasc.net
         ; Mon, 14 Mar 2011 11:07:04 +0000
    X-TM-IMSS-Message-ID:<[email protected]>
    Received: from gw.northport.com.my ([202.188.31.130]) by trust.uasc.net ([172.28.2.144])
    with ESMTP (TREND IMSS SMTP Service 7.1) id 45727fb90003495a ; Mon, 14 Mar 2011 11:06:52 +0000
    Received: from [192.1.10.13] (port=59768 helo=nmbsmtp-01.northport.com.my)
         by gw.northport.com.my with esmtp (Exim 4.69)
         (envelope-from <[email protected]>)
         id 1Pz5bs-0003EO-0A; Mon, 14 Mar 2011 19:06:48 +0800
    X-CTCH-RefID: str=0001.0A090205.4D7DF6C8.0116,ss=1,fgs=0
    Date: Mon, 14 Mar 2011 19:05:50 +0800 (SST)
    From: AMTedi-Container Svcs <[email protected]>
    Message-ID: <[email protected]>
    Mime-Version: 1.0
    To: [email protected], [email protected],
    [email protected], [email protected]
    Subject: CODCT1UAS
    Content-Type: multipart/mixed; boundary="-"
    X-TM-AS-Product-Ver: IMSS-7.1.0.1394-6.5.0.1024-18010.003
    X-TM-AS-Result: No--4.942-5.0-31-1
    X-imss-scan-details: No--4.942-5.0-31-1

    If you were assuming that every message would have a valid body part
    and that they would tell you definitively which parts you should consider to
    be "attachments", ya, that won't work. The disposition is a hint at best.
    It can be wrong. It might not even be there.

  • Dynamic File naming in Mail attachment

    Hi experts,
      I am doing a Mail to File scenario, in which at the sender side I have a mail with File attachments.We are using IMAP protocol and picking up from a URL.At the receiver end we have to provide a file which is the attachment from the incoming mail.
    With the help of the module I have separated the body and the attachment and the file is created with the static name I provided in the File adapter
      My requirement is to dynamically name the file based on the customer name.I am not configured the design part, as no mapping of the interfaces are required.
    For some reason,I am not able to open the mail bodyin sxmb_moni,but can see the attached file.
    Thanks,
    Tushar

    there is no standard way.
    you will have to write a module to get this in place.
    other ways are;
    XI Mail Adapter: An approach for sending emails with attachment with help of Java mapping - /people/stefan.grube/blog/2007/04/17/xi-mail-adapter-an-approach-for-sending-emails-with-attachment-with-help-of-java-mapping
    Dynamic name in the mail attachment - pseudo "variable substitution" :
    /people/michal.krawczyk2/blog/2006/02/23/xi-dynamic-name-in-the-mail-attachment--pseudo-variable-substitution

  • Mail attachement content trnsfer encoding 8bit , 7bit

    Good morning to everybody.
    I have a problem reading mail attachement.
    When the attachement is 8bit encoded the exadecimal char "3D" is write in a file as "0D". This is wrong
    When the attachement is 7bit encoded the exadecimal char "3D" is write in a file as "3D" . Thi is right
    Is there anyone who knows why of this beaviour?
    Many thanks

    I'm using the msgshow.java that is the example included in the java mail library.
    Attachement downloaded with JavaMail (the bad one):
    �� 3D ==> 0D (CR)
    2007-05-15;18.11.26;978;000469,00;380;Italy
    ;LUISA SPAGNOLI NAPOLI IT;34009575;8036527 ;5651;00;
    Attachement downloaded with outlook (the good one):
    �� 3D not translated
    2007-05-15;18.11.26;978;000469,00;380;Italy =
    ;LUISA SPAGNOLI NAPOLI IT;34009575;8036527 ;5651;00;
    Here the properties of the mail message:
    Microsoft Mail Internet Headers Version 2.0
    Received: from EXSMTP-IN2.sede.corp.sanpaoloimi.com ([10.244.7.21]) by EVS01.sede.corp.sanpaoloimi.com with Microsoft SMTPSVC(6.0.3790.2499);
         Mon, 28 May 2007 08:09:14 +0200
    Received: from secgw-b-e02.intesabci.it ([172.19.0.27]) by EXSMTP-IN2.sede.corp.sanpaoloimi.com with Microsoft SMTPSVC(6.0.3790.2499);
         Mon, 28 May 2007 08:09:13 +0200
    Received: MHUBINT
    Received: FW
    Received: from mail1.ssb.it ([192.106.129.13])
         by mailbox.intesabci.it with SMTP id l4S696n5006757
         for <[email protected]>; Mon, 28 May 2007 08:09:09 +0200
    Received: (qmail 11377 invoked by uid 509); 28 May 2007 06:02:04 -0000
    Received: from 127.0.0.1 by Imhotep (envelope-from <[email protected]>, uid 501) with qmail-scanner-2.01
    (spamassassin: 3.1.3.
    Clear:RC:1(127.0.0.1):.
    Processed in 0.078893 secs); 28 May 2007 06:02:04 -0000
         Mon, 28 May 2007 08:02:03 +0200 (CEST)
         (Postfix) with SMTP id 6798F34257;Mon, 28 May 2007 08:02:03 +0200 (CEST)
    to: <[email protected]>,
    from: <[email protected]>
    subject: 28 May 2007 08:00 PS12 FROD-ATM1
    MIME-Version: 1.0
    Content-Type: multipart/mixed;
         boundary="P=_NextPart_000_01BD3BAF.A762FD80"
    Date: Mon, 28 May 07 08:00:27 B
    Message-Id: <[email protected]>
    Return-Path: [email protected]
    X-OriginalArrivalTime: 28 May 2007 06:09:13.0674 (UTC) FILETIME=[B707A2A0:01C7A0EE]
    --P=_NextPart_000_01BD3BAF.A762FD80
    CONTENT-TYPE: TEXT/PLAIN; CHARSET="US-ASCII"
    Content-Transfer-Encoding: 8bit
    --P=_NextPart_000_01BD3BAF.A762FD80
    Content-Type: text/plain; charset=us-ascii; name="SPIMI.TXT"
    Content-Disposition: attachment
    Content-Transfer-Encoding: quoted-printable
    X-MIME-Autoconverted: from 8bit to quoted-printable by mailbox.intesabci.it id l4S696n5006757
    --P=_NextPart_000_01BD3BAF.A762FD80
    CONTENT-TYPE: TEXT/PLAIN; CHARSET="US-ASCII"
    Content-Transfer-Encoding: 8bit �������� I think the problem is here
    P=_NextPart_000_01BD3BAF.A762FD80

Maybe you are looking for

  • Error in RWB for EbXML Message

    Hello Experts, We are facing an issue with the Seeburger Adapter. When we trigger message TO THE sEEBURGER sYSTEM USING THE eBxml adapter, the message is successfully processed in PI 7.1 and shows a checkered flag. But on analyzing the related messag

  • Problems making a PDF from Indesign CS5

    Hi friends. I have recently switched to CS5 and I find that I usually need to close the program and then reopen it before I can make a PDF. It says it is working in the background but all it does is spin without creating the PDF. Anyone else having t

  • Is there max number of switches I can connect to Linksys SD2008? Slow down issues...

    I have a SD2008 main 8-port switch.  Connected to this, I have THREE 5-port switches from DLINK, each on its own SD2008 port. 1) My DSL provides 10 Mbps maximum. 2) On two of the DLINK switches, I can get 10 Mbps with speedtest.net 3) On third switch

  • IPhone 5 unable to connect to internet or use web-based apps like Facebook or Tumblr

    About two days ago, shortly after using my iPhone 5 to upload a picture of my son eating a donut to Facebook, I seem to have lost all ability to connect to the internet or update content on web-based apps like Facebook or Tumblr.  I tried to restore

  • CC says installation successful but errors so it won't actually install, help?

    I recently bought Adobe CC.  My computer crashed so i lost my initial install of Adobe CC because i had to do a reinstall that was based on a back up from before i had purchased CC. (Side Note: I installed CC on a family member's comp after my comp c