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

Similar Messages

  • Word & Excel will not send open Document as an Email Attachment

    I have a user (one of the firm's managing principals), who can no longer Email the currently open document as an attachment from Word or Excel.  The last thing
    that was installed on her system was Outlook 2013, it is set as the default email software.   She also has Office 2003, this was left on her machine to help in the transitioning into the newer version, I am not sure how much she uses this.<o:p></o:p>
    is there a way to correct this 'WITH OUT' installing Office 2013?
    <o:p>Thank you,</o:p>
    <o:p>Robert</o:p>

    Hi,
    The "Send as Attachment" option only works when Outlook and word are installed from the same suite. That is required.
    Thanks,
    Ethan Hua CHN
    TechNet Community Support

  • Sending document as an email attachment

    I have just installed pages '08 and trying to find out how to send a document as an email attachment. I accustomed to using Word, which has "send as an attachment" in the File menu, which is very convenient, since it takes a couple of seconds and you don't have to save and find files to drop into the email.
    Does Pages have anything like this?

    Pages doesn't have a function like that, and in fact Pages files are a bit cumbersome to mail, since they need to be archived (compressed/"zipped") first, to ensure they get sent correctly. In other words, the process is to select the document in the Finder, in the File menu choose "Create Archive" and then attach the resulting file to the email.
    There is a trick however that will make doing this easier -- if you have a saved Pages file, you can go up to the title bar and Control-click on the icon next to the file name. This action will produce a dropdown menu that lists the path to the file. The item just below the file name is the folder that the file is in -- if you choose that item, you will see a Finder window for that folder pop up, with the file name highlighted. You can now immediately go to the Finder's File menu and choose Create Archive. This technique means you don't have to hunt around for where the file is located on your computer, and can speed things up a bit. (This Control-click on the proxy icon works in all windows in OS X, not just for Pages.)

  • I'm trying to send a pages document as an email attachment to pc users.  They can't access the document.

    I'm trying to send a pages document as an email attachment to pc users.  They can't access the document.  When I try go to the "file" menu, there is no "save as" option.

    Hi Shelly,
    Command-P (Print)
    In the Print dialogue, click the PDF button at lower left, choose Mail PDF
    The result should be a new email document with the pdf file attached.
    Address and send.
    The procedure applies to any document which may be printed, not just Pages documents.
    Regards,
    Barry

  • How do I send pages documents in my email to people who do not have pages? have pages?

    How do I send Pages Documents in my email to people who do not have Pages?

    Share > Send to Mail > PDF  will create a suitable size attachment in a new message in Mail

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

  • Regarding Pages: I can't access the document I was writting on at all. I have tried to send the document to my email, I've tried to make a copy but nothing seems to work, it just shows up blank.

    Regarding Pages: I was writing using the app Pages when I left the page I was writting on but now I can't access it at all. I have tried to send the document to my email, I've tried to make a copy but nothing seems to work. The document still exists and I can see my writting as I can with all other documents but I can't open that page.

    Try:
    - Reset the iOS device. Nothing will be lost
    Reset iOS device: Hold down the On/Off button and the Home button at the same time for at
    least ten seconds, until the Apple logo appears.
    - Connect the iPad to your computer and try to get the document via File sharing
    - Try getting the document from iCloud.com if you are using iCloud

  • How can i send a document through my email with a ipod touch 2nd generation?

    How can i send a document through my email with a ipod touch 2nd generation?

    https://itunes.apple.com/us/app/id314894105?mt=8
    https://itunes.apple.com/us/app/id306273816?mt=8
    They have some limitations though. They have paid versions that remove those limitations

  • How at send a Word document as an email attachment from an ABAP program?

    Hi all,
    i got request to develop background run program which check which staff is due CONFIRM and able to attach confirmation form (Microsoft Word file) to HR and CC staff manager as recipients.
    I try almost all relevant FM but still face problem below, please assist.
    1) FM SO_DOCUMENT_REPOSITORY_MANAGER
    - A window pops up requesting Recipient email ids. I couldn't get the window suppressed.
    2) FM SO_NEW_DOCUMENT_ATT_SEND_API1
    - Since the attachment is a pre-formatted Word Document and not an Excel or Text document, couldn't process the contents into the internal table (most sample in forum is Excel not word)
    Appreciate ABAP folks who have sample code attach a word file will help on this.
    Thanks and regards,
    Felicek

    Hi ,
    sorry for my request but I have to send an e-mail with word attachment and I would appreciate if someone could give the code for
    the first part of this link: http://www.divulgesap.com/blog.php?p=ODI=
    (I mean 'ZDIV_SEND_EMAIL' ) . The problem is that I have to load in an internal table the file word (by using "open dataset in binary
    mode" I suppose ) and then pass this table to a FM or a method for sending e-mail with this file WORD but I 'm facing some
    problems....  any suggestion would be very appreciated ... I'm in a "impasse"  ! It's seems there is no way out !!!
    Thanks in advance
    Andrew

  • Send pdf (Adobe Form) as email attachment using BCS

    Hello everybody!
    I want to send a pdf, generated by Adobe Forms function module, as an email attachment to a certain external mail receiver. I have read that the methods of the Business Communication Services can render this, but I couldn't create a working solution. Can somebody give me a coding example for this scenario?
    I would be very happy if somebody could help me!
    Best regards,
    Markus

    Hello Alex!
    your link to this document was very helpful. The scenario described in the pdf is almost what I was looking for. The only problem is, that the mail is sent to the Business Workplace Inbox. I want to send it to an external e-mail address. When I change the programm part where the recipient is defined like this:
    Create recipient
      DATA lo_recipient TYPE REF TO if_recipient_bcs VALUE IS INITIAL.
      DATA l_reci    TYPE adr6-smtp_addr VALUE 'somemailaddress'.
      lo_recipient = cl_cam_address_bcs=>create_internet_address( l_reci ).
    Set sender
      lo_send_request->add_recipient(
        EXPORTING
          i_recipient = lo_recipient ).
    then no mail is sent to the recipients mailbox. I tried several variants but no mail is sent. Does somebody know how to set an external e-mail as recipient in this case?
    Best regards!
    Markus

  • HT4061 How do you send pages Document as an pdf attachment

    When emailing pages document from pages on iPad. Sometimes it sends as a small PDF square.
    Sometimes sends the entire document with any comments I made about the document.
    When you send the document with afew lines of comment they go through as part of the document.
    I have done it both ways and don't know the procedure. I just seem to luck out sometimes.
    Any comments
    Paul

    Start Pages and when in the view of the document thumbnails tap Edit.
    Tap the document you want to send as a PDF to select it.
    Then tap the Share icon, the icon of the curved arrow coming out of a rectangle.
    Select Mail
    Tap PDF
    This will convert the document to a PDF which is attached to an email. If the original Pages document is a one page document the PDF will show all text in the email. If the document has more that one page all you'll see is the PDF attachment icon.
    Address the email.
    Add any additional text you want.
    Tap Send to send the email.

  • Sending a document as an mail attachment with approve and reject button

    Hi all,
         i have an infopath form where a user fills the form and on submit the form is saving as an document in the document library,
    now my question is, how can i get this document as an mail attachment with approve and reject option.

    Hello,
    You need to hide them on form load for user. Add one more hidden control in form and keep control value blank initially. Now add rule on button submit to set the control value to some other so you can hide/show the button.
    Now add rule on approve and reject buttons that, if field1 is blank then hide this control.
    http://office.microsoft.com/en-in/infopath-help/add-formatting-rules-HA101783371.aspx
    Hemendra:Yesterday is just a memory,Tomorrow we may never see
    Please remember to mark the replies as answers if they help and unmark them if they provide no help

  • I seem to be having trouble sending a PDF edited document as an email attachment?

    IT seems to send but then never arrives.  Im using trial version of Adobe Acrobat Pro XI.

    Hi Susan,
    I'd like to assist!
    Would you mind elaborating? The trial version has all the same functionality as the full version.
    Are you receiving a specific error message?
    Looking forward to hearing back from you!
    Kind regards, Stacy

  • Error when sending a document link via email

    Hi people,
    I am on SAP EP 6.0 SP15 and below I describe my scenario.
    I have some documents created in some KM folders. Today, I tried to send one of those documents via email to another portal user. If I go through Send To > Send Copy..., that other portal user receives the email with the document attached and he is able to open it... so far so good.
    However, if i try to send the same document but now using a link (Send To > Send Link...), the other guy receives the email, but the link results in a 404 error when clicked.
    I investigated a little and found that the link sent contains "" signals to indicate spaces in the folder names, instead of "%20". I believe this is the issue, because if I change manually the "" signals to "%20", the link works perfectly.
    My question is: is there a way to configure the sistem to use "%20" instead of "+" to represent spaces? Or I will have to remove the spaces from ALL my folder names?
    Thanks
    Fernando Urzedo

    Hi Fernando,
    this seems to be a bug. In the release notes of KMC SPS16 incl. P1, this is not reported as fixed (on the other hand, not every fixed bug gets reported in the release notes).
    You could try to patch your portal first; if you don't can do this at the moment or if the bug persists after patching, please open an OSS message.
    Hope it helps
    Detlev

  • How can I save a word document from an email attachment to iBooks?

    I can't figure out how to save a word doc from an email to iBook.

    Hold down the attachment and select the app to Open In
    http://i1224.photobucket.com/albums/ee374/Diavonex/Album%201/242638015dbb372615a d249433833f07.jpg
    Have a look at the following:
    http://itunes.apple.com/sg/app/quickoffice-pro-hd-edit-office/id376212724?mt=8&l s=1
    http://itunes.apple.com/sg/app/office2-hd/id364361728?mt=8&ls=1
    http://itunes.apple.com/sg/app/documents-to-go-premium-office/id317107309?mt=8&l s=1
    http://itunes.apple.com/sg/app/polaris-office/id513188658?mt=8&ls=1

Maybe you are looking for

  • Iphone 5 back camara not working after ios update

    My Iphone 5 back camara is not working after ios 8.1 update this morning Only getting some fuzzy image. Camara was working before the update. Resting the phone to factory setting restoring phone nothing seems to work I think this will be my last Ipho

  • HT5622 How do I change the phone number to my iMessage on my iPad.

    How do I change the phone number on my iMessage on my iPad?

  • Xfce hangs if I change resolution

    Hello, I got xfce working but the screen resolution is extremely low. If I change it in the settings program xfce hangs. What could be the problem, and how could I fix it? Thanks, Jules

  • Unable to Restore my iPad after software update

    I just updated all Apple software and went to sync my ipad with itunes...it would not allow me to restore with my back-up information it kept saying there was an error while trying to restore. It gave me 3 options, cancel Restore to factory settings,

  • Lost Events in Library

    I only have one event in my library, I used have more. When I open finder and look at the library file, its almost 40GiGs. But only 16 photos show up, when I open it. Any ideas why this is happening or how to recover those lost events?