Mail Attachment from KM

I have some trouble to send a File in a Mailattachment from KM.
The Mail has a Attachment with the correct name of the file, but the File on the Mail is empty.
Hier is the code:
//Init
Session session = Session.getInstance(props, new javax.mail.Authenticator() {
protected javax.mail.PasswordAuthentication getPasswordAuthentication() {return new   
                                javax.mail.PasswordAuthentication(props.getProperty("User"), props.getProperty("Password"));
session.setDebug(new Boolean((String)props.get("mail.session.debug")).booleanValue());
MimeMessage message = new MimeMessage(session);
Multipart mailContent=new MimeMultipart();
MimeBodyPart mailText=new MimeBodyPart();
message.setFrom(new InternetAddress(from));
InternetAddress[] toAddresses = new InternetAddress[to.length];
for (int i = 0; i < to.length; i++) {
          toAddresses<i> = new InternetAddress(to<i>);
message.setRecipients(Message.RecipientType.TO, toAddresses);
//Body
message.setSubject(subject);
InternetAddress[] replyToAddresses = new InternetAddress[1];
replyToAddresses[0] = new InternetAddress(replyTo);
message.setReplyTo(replyToAddresses);
mailText.setContent(unicodeString(body), "text/html");
mailContent.addBodyPart(mailText);
//Attachment
IUser contextUser = WPUMFactory.getServiceUserFactory().getServiceUser("cmadmin_service");
ResourceContext resourceContext = new ResourceContext(contextUser);
IResourceFactory resourceFactory = ResourceFactory.getInstance();
IResource resource = resourceFactory.getResource(RID.getRID("/documents/KlinikumStuttgart/out2.xml"), resourceContext);
InputStream is = resource.getContent().getInputStream();
MimeBodyPart mmattch = new MimeBodyPart (is);
mmattch.setFileName(resource.getName());
mailContent.addBodyPart(mmattch);
message.setContent(mailContent);          
//Send
Transport transport = session.getTransport(props.getProperty("mail.protocol").toLowerCase());
transport.connect((String)props.get("mail.smtp.host"), Integer.parseInt((String)props.get("mail.smtp.port")),(String) props.get("User"), (String)props.get("Password"));
Transport.send(message);
transport.close();     
How is it possible to get the full file form KM in the Attachment ?
Can somebody help me?
THX

Hi Sebastien,
Please refer to this link from Forum Posts onn Email with Attachment in KM.
[Attachment with EMAIL|https://www.sdn.sap.com/irj/sdn/thread?threadID=98781]
Hope of some help.
Regards,
Shailesh Nagar

Similar Messages

  • How to send the Adobe page as mail attachement from webdynpro...

    Hi Experts,
    How to send the Adobe page as external mail attachment from webdynpro automatically (for example: If I input the data for sales order in a view and created the sales order, if the sales order is created then have to place the created sales order number and the some details in a adobe form and should send as external mail and have to specifying the body as "Sales order created and details can be found in the attached adobe form" from webdynpro).
    Do the needful.
    Thanks & regards,
    Ravi.

    Hi ravi,
    See the WDA forum for the how to attach a file in webdynpro component for the attachments.

  • Can't open e-mail attachment from Russia to UK

    Hello,
    I've been sent an e-mail attachment from Russia to the UK but when I click on 'downdload file' I get the message 'Cannot open file'.
    I'm using Windows 7 on a laptop.
    Would be grateful for any advice.

    Better yet, ask the sender to use a file sharing service (Acrobat Workspaces, Dropbox, Google Drive, ...), then send the download link by email.

  • How do i open an e-mail attachment from WINDOWS

    heres my question
    Someone approached me in church today,they know i have a Macbook
    They recieved an e-mail with an attachment from someone else
    they went to open the attachment,Right away Microsoft Office opened and told them their TRIAL had expired.
    I recommmended they look in Spotlight and also under system preferences in the blue apple
    What he needs in something In the Macbook Already that will open the attachment so he can read it.
    Will the trial version of I-Work do it?
    he is looking or something quick that will work
    thanks

    CoffeehouseSchmuck,
    The attachment is evidently a Word file, and the person in question evidently just clicked on the attachment in the email message. When you do this, Mail will attempt to have the associated application open the attachment.
    The first problem is that only a trial version of Word is present, and the second is that the person in question is simply clicking on the attachment. First, get the attachment to the Desktop by dragging it there (or using the "Save Attachment.." button in Mail).
    Once the attachment is on the Desktop, select it, then press Apple-I to open a Getinfo window for it. Use the "Open With.." pull-down to change the default application to open this type of document, then click the "Change All" button.
    Text Edit will open Word documents, but the formatting might be funky. However, this should be sufficient for simply reading attachments. An iWork trial version of Pages will be able to handle it with all formatting in place, but this will only work until the trial expires.
    Ideally, the person in question should acquire either MS Office or the free NeoOffice.
    Scott

  • Download E-Mail + Attachment from CRM System to Local Harddrive

    Hello,
    I need to download all E-Mails (incl. Attachment) from the CRM EIC Webclient System to the local
    harddrive (alternatively to the server drive). If its possible, I need the relation from the one order
    number to the mails (inlc. Attachment).
    Does anyone knows where the Mail are stored in the CRM Webclient System? Or can anyone
    give me a hint how I can realise a mass download (function module, class, method,...).
    The reason is, that the CRM System will be shutdown concerning insolvency and the Mails are
    necessary for the liquidation.
    Thanks,
    Andreas
    Edited by: Andreas Faatz on Jan 25, 2010 4:26 PM

    Hello Andreas,
    Just to clarify, I assume that you are referring to emails that arrive into the system via SAP Connect interface and are processed via the Agent Inbox (and not referring to emails that arrive via the ICI interface and are directly pushed to agents)? The ICI emails are typically stored on a third-party email server, so they would not be stored in SAP CRM. On the other hand, the SAP Connect emails are stored in the CRM system, sort of, though its rather complicated. The emails are converted into a combination of CRM workflow and SAP Office document and are broken up and stored in a variety of different tables. So there isn't really an single email that is stored and easily retrieved.
    Incoming ICI emails are first converted into an SAP workflow work item until accessed in IC and then are converted and stored as SAPoffice document in tables SOFM, SOOD  (header info) , SOC3  (for non krpo) , SOFFCONT1 (for  kpro / binary data) -- and if the document has been sent -- also in SOOS, SOST, and SOES (for externally sent documents). I'm not sure if this helps you at all
    Best regards,
    John

  • How do i delete an already downloaded e mail attachment from my ipad

    I have downloaded a rather large .wav file attachment on my ipad  air via gmail. I have listened to it made the comments i needed for my correspondence and now i need to delete it from my device to save space, but i don t seem to find it anywhere. Does anyone know how do i do this ? I am a very new user and i m  kind of panicking over the event. 

    Thank you for your immediate response!
    I did not open with any specific app. I just touched the attachment icon it downloaded and after a moment i  the quicktime player symbol  showed up for a second and it started playing.
    I assumed i will find it afterwards in music but i didn't.

  • Can't send PDF as a mail attachment from iPad to a Lotus Notes account

    Hello, I have some problems sending PDF documents as email attachments from my iPad. Using the adobe reader app for iOS, I create an email with the file attached. Sending this to e.g. a hotmail account works fine. However, if I send it to any address at my company, where Lotus Notes is the standard, the attachment seems to be converted into a text file. Is this a known issue with the reader for iPad, or should I rather be looking to IT support at my company for help?

    Download QuickOffice, which Google is now making available for free:
    https://itunes.apple.com/us/artist/quickoffice-inc./id294258240?mt=8
    You can open the XLS attachment in that app, then transfer the document to your Mac via the USB cable. You can then print from the Mac.
    Printing from your iPad doesn't work via Bluetooth either, by the way.
    Regards.

  • Get filename of an e-mail attachment from the sender

    Hi,
    I have a question regarding attachments in a sender mail adapter. I have to detach the attachment and save it on the local file system. That's not the problem, I'm able to swap the payload and save on the filesystem.
    The problem is to get the orginal file name of the attachment. I see in the message monitor it is stored in the content-type, eg:
    content-type:application/octet-stream;name="filename.csv"
    How do I get the "filename.csv", to be able to save the csv file under that name on the file sytem.
    Thanks for answering.

    Yes, for PI the next SP is 11, but SP 12 corresponds with XI SP 20 and SP 14 corresponds to XI SP 21. SP 11 and SP 13 are intermediate SPs.
    Don't ask me why.
    Here the schedule:
    https://service.sap.com/~sapdownload/011000358700000294692004E/Stack_Planning.htm
    Regards
    Stefan

  • Can I somehow copy mail attachment from iPhone to Mac?

    Hello.
    I would like to use my iBook in work (Im really really tired with PCs). Problem is, that all files I use are on PCs. I cannot connect directly to our work network, nor I can use internet connection here.
    I can either use flash disc to move files. But I have other prefered way in mind. I would like to send files from my work PC by mail to my iPhone (thats the easy part using Edge) and then get these files to Mac (not through internet). Is there a way to do it? Through wifi network connection, blue tooth, cable connection? I didnt actually tested it yet, but I dont think Mail in iPhone would for example easily synchronize with Mail in iBook just by connecting iPhone to iBook with cable.
    Any advices? Thanks.

    Maybe I should more specify what Im talking about:
    I need to move files from PC to Mac and back, so I can distribute them through internal network. I cannot connect to PC with Mac (admin doesnt allow that), my Mac doesnt have internet connection here. I can use the flash drive for file moving, but Im looking for something more sophisticated (if its possible).
    I would love to use Mac/PC soft Dropbox, but I cant install anything on my PC (admin doesnt allow that). So I was hoping that:
    1) I could send/recive files via mail and get them through iPhone - PC Outlook -> iPhone Mail -> Mac and Mac -> iPhone Mail -> PC (using wifi connection between Mac and iPhone, cable, blue tooth, whatever) or
    2) I could somehow use iPhone with its Edge connection as a modem for iBook (which would be totally best, because I could also use "slow" edge connection ,with my unlimited data plan, for web browsing etc.

  • Mail Attachment from SAP

    Hello,
    I am running a report in the background and the spool receipnt list is maintained in the system .
    But when  i receive the same output to my Mailaddress as PDF. attachment i cant read the document , font is very small .
    CAN anybody suggest me the solution for how to Increase the font size of the document and other settings required to make everything clear in the document .
    Urgent
    Regards,

    Hi shisupal,
    I am not sure if this will help but jus take a look at the FM below!
    PDF Format – Call the function module CONVERT_ABAPSPOOLJOB_2_PDF and pass the spool number
    CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
           EXPORTING
                src_spoolid              = f_spool
                no_dialog                 = ' '
                dst_device               = 'LOCL'
           IMPORTING
                pdf_bytecount                 = w_bytecount
           TABLES
                pdf                                = itab_pdf_output
           EXCEPTIONS
                err_no_abap_spooljob            = 1
                err_no_spooljob               = 2
                err_no_permission                 = 3
                err_conv_not_possible            = 4
                err_bad_destdevice               = 5
                user_cancelled                   = 6
                err_spoolerror                   = 7
                err_temseerror                = 8
                err_btcjob_open_failed   = 9
                err_btcjob_submit_failed = 10
                err_btcjob_close_failed   = 11
                OTHERS                        = 12.
    Transfer the 132-long strings to 255-long strings
      LOOP AT itab_pdf_output.
        TRANSLATE itab_pdf_output USING ' ~'.
        CONCATENATE w_buffer
                    itab_pdf_output
               INTO w_buffer.
      ENDLOOP.
      TRANSLATE w_buffer USING '~ '.
      DO.
        itab_attachment = w_buffer.
        APPEND itab_attachment.
        SHIFT w_buffer LEFT BY 255 PLACES.
        IF w_buffer IS INITIAL.
          EXIT.
        ENDIF.
      ENDDO.
    Thanks and regards,
    pavithra

  • How can i have mail attachments from dropbox

    I am using my ipad in my business, and have all my company's file archive on dropbox. I mostly send mails from a webbased crm, and also frim the mail-app in my ipad. But in any situation i only can have mail attachment from myy pictures! How do i set up my ipad so i can pick my attatchments from other places??
    The link sending service from inside dropbox is not good enough for me.

    Hi Oawinje,
    I use the Office2HD app to attach my Dropbox files to email rather than sending a Dropbox link.
    https://itunes.apple.com/us/app/office2-hd/id364361728?mt=8
    You can link Office2HD to your Dropbox account. Then within Office2HD you navigate to your file. Click on the ">" button next to your file listing and select "Email File." This attaches the file (not a link) to a new email message. I haven't found a way to attach multiple files though…
    I don't think you are not going to find the attachment option available within the iOS Mail app due to "sandboxing." IOS apps are all "sandboxed" to prohibit access to their data from other apps. Apple would have to build Dropbox into iOS and have the iOS Mail app tightly integrated with it to allow attachments like you're used to on an OS X computer (the file structure in iOS is very different from OS X). The attachments in iOS Mail must occur from the third party app (like Office2HD) rather than from Mail. I'm not sure why the Dropbox app doesn't offer the option to attach a file like Office2HD does…
    Hope this helps!
    ~Joe

  • Open attachment from AOL mail

    when i download a attachment from AOL mail I get a message "Adobe Reader could not open (name of file) it is not a supported etc

    What is your operating system?  Reader version?
    If you download the attachment to your local disk first, then open it from there, does it open?

  • Error while Opening PDF attachment from Mail

    Hi,
    We two Output Types created ZNEU and ZAUF. Two Smartforms are created for the same Output Types. The Issue now is, When ZNEU triggers and send a mail the document is properly decoded and gets opened but for ZAUF it doesn't. It says File damaged.
    This is the code we have used for sending mail.
    CONSTANTS:
              co_pdf(3) TYPE c VALUE 'PDF',
              co_raw(3) TYPE c VALUE 'RAW'.
      DATA:
            it_objbin TYPE STANDARD TABLE OF solisti1,
            wa_objbin TYPE solisti1.
      DATA:
             lv_filesize TYPE i.
      DATA:
            it_lines TYPE STANDARD TABLE OF tline.
      DATA:
            wa_mail_body TYPE solisti1,
            wa_receipients TYPE somlreci1.
      DATA:
           document           TYPE REF TO cl_document_bcs,
           content            TYPE solix_tab,
           wa_content         TYPE solix,
           send_request       TYPE REF TO cl_bcs,
           sender             TYPE REF TO if_sender_bcs,
           recipient          TYPE REF TO if_recipient_bcs,
           requested_status   TYPE REF TO bcs_rqst,
           status_mail        TYPE bcs_stml,
           bcs_exception      TYPE REF TO cx_bcs,
           lv_rec             TYPE adr6-smtp_addr.
      DATA:
             wa_attachx TYPE solix,
             l_pdf_len TYPE i,
             l_con_len TYPE i,
             l_pdf_pos TYPE i,
             l_con_pos TYPE i.
      FIELD-SYMBOLS: <fs_con> TYPE x.
      CLASS cl_cam_address_bcs     DEFINITION LOAD.
      CLASS cl_abap_char_utilities DEFINITION LOAD.
    * Get the PDF version of the OTF
      CALL FUNCTION 'CONVERT_OTF'
       EXPORTING
         format                      = 'PDF'
       IMPORTING
         bin_filesize                = lv_filesize
        TABLES
          otf                         = job_output_info-otfdata
          lines                       = it_lines
       EXCEPTIONS
         err_max_linewidth           = 1
         err_format                  = 2
         err_conv_not_possible       = 3
         err_bad_otf                 = 4
         OTHERS                      = 5.
      IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    * Convert the PDF format to the table type required for the attachment.
      CALL FUNCTION 'QCE1_CONVERT'
        TABLES
          t_source_tab         = it_lines
          t_target_tab         = it_objbin
        EXCEPTIONS
          convert_not_possible = 1
          OTHERS               = 2.
      IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    * Convert the data which is in text to binary
      l_con_pos = 0.
      DESCRIBE FIELD wa_objbin LENGTH l_pdf_len IN BYTE MODE.
      DESCRIBE FIELD wa_attachx LENGTH l_con_len IN BYTE MODE.
      LOOP AT it_objbin INTO wa_objbin.
        ASSIGN wa_objbin TO <fs_con> CASTING.
        CHECK sy-subrc EQ 0.
        DO l_pdf_len TIMES.
          l_pdf_pos = sy-index - 1.
          IF l_con_pos = l_con_len.
            APPEND wa_attachx TO content.
            FREE wa_attachx.
            l_con_pos = 0.
          ENDIF.
          MOVE <fs_con>+l_pdf_pos(1) TO wa_attachx-line+l_con_pos(1).
          ADD 1 TO l_con_pos.
        ENDDO.
      ENDLOOP.
      IF l_con_pos > 0.
        APPEND wa_attachx TO content.
      ENDIF.
      TRY .
    *     -------- create persistent send request ------------------------
          send_request = cl_bcs=>create_persistent( ).
    *     -------- create and set document with attachment ---------------
    *     create document from internal table with text
          document = cl_document_bcs=>create_document(
                        i_type    = 'RAW'
                        i_text    = mail_body_tab
                        i_subject = email_subject ).
    *     add attachment to document
          CALL METHOD document->add_attachment
            EXPORTING
              i_attachment_type    = 'PDF'
              i_attachment_subject = attachment_name
              i_att_content_hex    = content.
    *     add document to send request
          CALL METHOD send_request->set_document( document ).
    *    Set sender
          sender = cl_cam_address_bcs=>create_internet_address( sender_id ).
          CALL METHOD send_request->set_sender
            EXPORTING
              i_sender = sender.
    *     Receipients
          LOOP AT receipients_tab INTO wa_receipients .
            lv_rec = wa_receipients-receiver.
            recipient = cl_cam_address_bcs=>create_internet_address( lv_rec ).
    *       Add recipient with its respective attributes to send request
            CALL METHOD send_request->add_recipient
              EXPORTING
                i_recipient = recipient.
          ENDLOOP.
    * Set that you don't need a Return Status E-mail
          status_mail = 'N'.
          CALL METHOD send_request->set_status_attributes
            EXPORTING
              i_requested_status = 'N'
              i_status_mail      = status_mail.
    * set send immediately flag
          send_request->set_send_immediately( 'X' ).
    * Send document
          CALL METHOD send_request->send( ).
    *      COMMIT WORK.
        CATCH cx_bcs INTO bcs_exception.
          RAISE EXCEPTION bcs_exception.
    ENDTRY.
    This is in a Class which is been used in the print program for both the Output Types.
    Can somebody throw light upon this.
    Note: I tried using
    but it is not working properly.
    Thanks,
    Prashanth
    Edited by: Prashanth KR on Jan 5, 2010 6:20 AM

    Hi,
    Please paste the part of code where you are getting error.
    And if you are not clear about where the error is, try searching sdn or google with the error message that you are getting as this issue has been discussed many times earlier.
    Check this link.
    Error while opening PDF in mail attachment
    Hope it helps.
    Regards,
    Raj

  • Reading an PDF Attachment  From Sender Mail Adapter

    Hi All,
                   i am able to get a mail  from my Mail Server, But my aim is need to Read an PDF attachment from the mail, in SXMB Moni i am getting the Payload with attachment, I have a created a module to convert that PDF to XML(Module is working fine in file to file sceneraio) .
    In adapter should i need to use Payload Swap Bean Module also , because in sap help said that i need  Select Keep Attachments. I want to know how that how to Push the PDF attachment to My Custom Module which is used to convert the PDF To XML.
    If Payload Swap Bean Module needs to be Used , please tell me the Key Names and Key Values to be used.(swap.keyName,swap.keyValues)
    Thanks and Regards,
    Kamal
    Note: Points will be awarded

    Kamal...
    See if this helps
    [Module Name]
      AF_Modules/PayloadSwapBean
    [Module Parameters]
    The following parameters are used for this module
      swap.keyName          the name of a supported attribute.
      swap.keyValue         the value of a partial string that is required
                            to appear.
    The supported attributes (swap.keyName) include the payload attributes
    such as payload-name, payload-description and any content attributes
    such as content-type, content-disposition, content-description, etc.
    Regards
    Ravi Raman

  • How to get filename from mail attachment

    Hi all,
    I have a XI scenario Mail->XI->RFC. I have created my own adapter module which handle all attachments from incoming mail.
    Everything work fine, but in my module I try to get information about filename of mail attachment. I use getContentType() metod to get the filename but this method return only the mimetype of the document. The getDescription() method return olny string "mail attachment". I need to get the original filename of the attachment or at least the file extension. 
    Is it possible to get the whole filename from mail attachment?
    Thanks
    Peter

    Hi,
    You can tryout with adapter modules . You can make use of following Adapter attributes also -
    http://help.sap.com/saphelp_nw2004s/helpdata/en/ad/bf93409c663228e10000000a1550b0/content.htm
    Similar discussion-
    Email attachment file names
    PayloadSwapBean-
    /people/michal.krawczyk2/blog/2005/12/18/xi-sender-mail-adapter--payloadswapbean--step-by-step
    Regards,
    Moorthy

Maybe you are looking for