Attached PDF file in mail through PL/SQL, unable to open

Hi All,
Database : Oracle Database 10g Release 10.2.0.1.0 - Production
I have database procedure which attach a pdf in mail and send to specified user.
Its working fine, but my problem here, if inside the PDF file have any logo or images, user unable to open the attachment file.
It give error "It was sens as an email attachment and was not correctly decoded".
For Encoding I have used : utl_encode.base64_encode
If normal PDF file they can open.(I mean without any locg or images).
Please give me your solution for handle this situation.
Thanks in advance.

Sun wrote:
Thanks for your advice,
Please let me know, how can i do this. plz..What do you not understand in my suggestion?
Use your own mail reader. Create an e-mail. Attach the PDF. Send the e-mail to your address.
In your inbox, the mail will arrive.
Now select the "+view raw format+" option of your mail reader (most mail readers have this, including MS Outlook).
Look at the contents of the mail body. This will show you how the attachment was inserted into the mail itself. Look at the Mime types. Look at the mail header. This is a working example of what your code needs to create as an e-mail body in PL/SQL (or any other language).
This is not rocket science....

Similar Messages

  • Single page PDF file in mail always appears in message body, instead of as an attachment, contrary to a multiple page PDF. Why?

    When sending a single page PDF file in mail, it always appears as an open file in the message body. Multiple page PDF files appear as attachments. Why the difference and how to change the behavior of single page PDF files so that they appear as attachments instead of open files?

    Hello billsbs,
    Welcome to the Apple Support Communities!
    I understand that when you add a PDF to mail you see its entire contents, but when you add two or more pages Mail shows them as a document icon. To change this behavior for that specific email, please follow the instructions in the attached article. 
    Mac OS X Mail: About PDF attachments
    Have a great day,
    Joe

  • PDF files in Mail

    For a while now I have been having trouble with pdf files in Mail. Sometimes I cannot even open them as they appear as a little black dot. The trouble came to a head recently when one of the pdf files I work with for some reason opened up without one of the pages it should have had. This file opens fine on the other iMac we have that is running Tiger and when that iMac saves the file then I can open it just fine as well. But when I save it the page is missing on both mine and the other. Please help... my job is at stake! And I am not exaggerating

    What kind of computer and email program is sending it to you? If these are multi-page PDFs, they could show up in the body of the message, rather than as a separate attachment. If they do, you should be able to simply drag the file from the body onto your Desktop, and then you can open it with Preview or Acrobat Reader.
    Are you able to do this, and what happens when you drag the PDF into an open Safari window?
    Mulder

  • How do I email an attached pdf file to stationary templates in mail.

    How do I email an attach PDF file using the stationary templates in mail on lion.
    I attached the PDF but when try to send it I get back a dialog box that sez:
    "This message cannot be sent because it uses stationery and contains attachments that are not images. Messages with stationery cannot contain attachments that aren’t images. You can cancel and return to editing the message or remove the stationery in order to send." My choice is to cancel or remove stationary.
    Is there a third party solution? Any suggestion?

    No
    Envoyé depuis Molto pour iPad
    De: pwillener
    Envoyé: jeudi, février 12, 2015 07:14 AM
    À: René Allamelle
    Objet:  how do I compress a large pdf file to fit in an email?
    how do I compress a large pdf file to fit in an email?
    created by pwillener in Adobe Acrobat.com Services - View the full discussion
    But generally it is never a good idea to send e-documents as email attachments.  Better use a file sharing service (Acrobat.com, Dropbox, Google Drive, Microsoft OneDrive, ..), upload the document, then send the shared download link via email.
    If the reply above answers your question, please take a moment to mark this answer as correct by visiting: https://forums.adobe.com/message/7187079#7187079 and clicking ‘Correct’ below the answer
    Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page:
    Please note that the Adobe Forums do not accept email attachments. If you want to embed an image in your message please visit the thread in the forum and click the camera icon: https://forums.adobe.com/message/7187079#7187079
    To unsubscribe from this thread, please visit the message page at , click "Following" at the top right, & "Stop Following"
    Start a new discussion in Adobe Acrobat.com Services by email or at Adobe Community
    For more information about maintaining your forum email notifications please go to https://forums.adobe.com/thread/1516624.

  • Error in opening pdf file from mail attachment sent thru MII

    Hi,
    I am using MII 12.1.4 build(36).
    I have created a pdf file from BLS using PDF actions block and saving the file in web location as mentioned below:
    WEB://<ProjectFolder>/<subfolder>/Report.pdf
    I'm using the same file as attachment in my m a i l action block with attachment content type "application/pdf" and AttachmentContent "ImageSaver.EncodedImage" or "PDFDoc.Output".
    When i check the mail,i can see the attachment with some size of 8kb,but when I open the file i will get below error:
    "Adobe Reader could not open Report.pdf because it is either not supported file type or because the file has been damaged(for example,it was sent as an m a i l attachment and wasn't correctly decoded)"
    If I try to open the same file by exporting fit to my desktop,it opened properly.
    Anything I'm missing here?
    Thanks in Advane,
    Suresh

    Hi,
    According to below mentioned thread,this problem is fixed in 12.1.5 and above.
    Re: Attachment Content When sending PDF attachment in Send Mail Step
    Then I deployed the new patch ie SP07.
    Here there is one problem,ie in Menu page I can see the 12.1.7(Build40),when I open the workbech,it shows the previous patch 12.1.4(Build 36).Why is it so?
    All of my transactions running fine except the one which I have mentioned in my previous post.
    When I run the transaction mentioned in my previous post,it threw an excption for PDF Table Action block and the error mentioned below:
    [ERROR] Error found trying to execute action 'PDF_Table_0' Exception: [null]
    [ERROR] [PDF_Table_0] Action: Runtime threw an exception. Exception: [java.lang.StackOverflowError]
    When I can check the m a i l, I'm able to open the attached PDF file without error but without data.Is it because of the above mentioned error?
    Plz help me.
    -Suresh

  • We want to send a mail with attachment pdf file.

    Hi!!!
    We want to send a mail with attachment pdf file.
    The PDF file this is in the server sap.

    Hi,
    Pls check web logs like
    /people/thomas.jung3/blog/2004/09/08/sending-e-mail-from-abap--version-610-and-higher--bcs-interface
    Eddy
    PS.
    Put yourself on the SDN world map (http://sdn.idizaai.be/sdn_world/sdn_world.html) and earn 25 points.
    Spread the wor(l)d!

  • Convert Screen(spool) to PDF file sending mail with attach file

    Hi :
    I'd like convert spool list to pdf and sending file...
    so, I read thread about spool convert to PDF before,
    and know how to convert Spool to PDF file and send mail with attach file.
    but I have a problem.
    my solution as:
    step 1. Call function: "CONVERT_ABAPSPOOLJOB_2_PDF"
    step 2. Call function: "SO_NEW_DOCUMENT_ATT_SEND_API1"
    then, I got a mail with attached PDF file, but the PDF file display limited 255 line.( SO_NEW_DOCUMENT_ATT_SEND_API1 limited)
    I want to showing word is wider that 255.
    and then I find a manual method as:
    After program finished.
    Function Menu -> system -> List -> Send
    use Prog: "Create Document and Send"
    I use this prog sending mail and attached file ,
    PDF file do <b>NOT</b> have 255 word limit !
    finally. my question is, If I want sending mail as Prog: "Create Document and Send", how to do?
    which Function I have to use?...
    Please help me, Thanks!

    Hi,
    Check this sample code of sending spool as attachment to an email address..
    Parameters.
    PARAMETERS: p_email(50) LOWER CASE.
    PARAMETERS: p_spool LIKE tsp01-rqident.
    Data declarations.
    DATA: plist         LIKE sopcklsti1 OCCURS 2 WITH HEADER LINE.
    DATA: document_data LIKE sodocchgi1.
    DATA: so_ali        LIKE soli OCCURS 100 WITH HEADER LINE.
    DATA: real_type     LIKE soodk-objtp.
    DATA: sp_lang       LIKE tst01-dlang.
    DATA: line_size     TYPE i VALUE 255.
    DATA: v_name        LIKE soextreci1-receiver.
    DATA rec_tab        LIKE somlreci1 OCCURS 1 WITH HEADER LINE.
    Get the spool data.
    CALL FUNCTION 'RSPO_RETURN_SPOOLJOB'
         EXPORTING
              rqident              = p_spool
              first_line           = 1
              last_line            = 0
              desired_type         = '   '
         IMPORTING
              real_type            = real_type
              sp_lang              = sp_lang
         TABLES
              buffer               = so_ali
         EXCEPTIONS
              no_such_job          = 1
              job_contains_no_data = 2
              selection_empty      = 3
              no_permission        = 4
              can_not_access       = 5
              read_error           = 6
              type_no_match        = 7
              OTHERS               = 8.
    IF sy-subrc <> 0.
      MESSAGE s208(00) WITH 'Error'.
      LEAVE LIST-PROCESSING.
    ENDIF.
    Prepare the data.
    plist-transf_bin = 'X'.
    plist-head_start = 0.
    plist-head_num = 0.
    plist-body_start = 0.
    plist-body_num = 0.
    plist-doc_type = 'RAW'.
    plist-obj_descr = 'Test ALV'.
    APPEND plist.
    plist-transf_bin = 'X'.
    plist-head_start = 0.
    plist-head_num = 0.
    plist-body_start = 1.
    DESCRIBE TABLE so_ali LINES plist-body_num.
    plist-doc_type = real_type.
    Get the size.
    READ TABLE so_ali INDEX plist-body_num.
    plist-doc_size = ( plist-body_num - 1 ) * line_size
                     + STRLEN( so_ali ).
    APPEND plist.
    Move the receiver address.
    MOVE: p_email  TO rec_tab-receiver,
          'U'      TO rec_tab-rec_type.
    APPEND rec_tab.
    IF NOT sp_lang IS INITIAL.
      document_data-obj_langu = sp_lang.
    ELSE.
      document_data-obj_langu = sy-langu.
    ENDIF.
    v_name = sy-uname.
    Send the email.
    CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
         EXPORTING
              document_data              = document_data
              sender_address             = v_name
              sender_address_type        = 'B'
         TABLES
              packing_list               = plist
              contents_bin               = so_ali
              receivers                  = rec_tab
         EXCEPTIONS
              too_many_receivers         = 1
              document_not_sent          = 2
              document_type_not_exist    = 3
              operation_no_authorization = 4
              parameter_error            = 5
              x_error                    = 6
              enqueue_error              = 7
              OTHERS                     = 8.
    IF sy-subrc <> 0.
      MESSAGE e208(00) WITH 'Error'.
    ENDIF.
    COMMIT WORK.
    Send the email immediately.
    SUBMIT rsconn01
    WITH mode = 'INT'
    AND RETURN.
    Thanks,
    Naren

  • Attaching .pdf files in the workflow e-mail

    Hi,
    I have a custom workflow which sends a notification to the external vendor.In this scenario,i need to send the details as an attachment(.pdf files).
    I have installed CMSDK and iAS.Is there any sample code / example to integrate workflow with CMSDK??
    or atleast can i find the exact workflow document where can get this info?
    Please help.
    Thanks,
    lakshmi.

    Hi Raja,
    Thanks for your input.
    I have done some work on this but i am getting the following error..i am sending you the sample code too..
    please help.
    Error
    ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in call to 'TEST_LOB'
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    Error Name: -6550
    Error Stack:
    Wf_Notification.GetAttrDoc(40486, TEST_DOC, text/html)
    table : bob_lob
    c2 : column in bob_lob where i stored the .pdf document
    create or replace procedure test_lob (document_id in varchar2,
    display_type varchar2,
    document in out clob,
    document_type in out varchar2)
    as
    doc_lob clob;
    itemkey VARCHAR2(20);
    itemtype VARCHAR2(10);
    begin
    itemtype := substr(document_id, 1, instr(document_id, ':') - 1);
    itemkey := substr(document_id, instr(document_id, ':') + 1, length(document_id) - 2);
    document_type := 'application/pdf';
    select c2
    into doc_lob
    from bob_lob
    where c1 = 5;
    document := doc_lob ;
    exception
    when others then
    dbms_output.put_line(sqlerrm);
    end;

  • Attaching multipage .pdf file in Mail

    How do I attach a multipage .pdf file in Mail?  I am running OSX 10.8.2 on a MacBook Pro.  When I try to attach only the frst page attaches.

    Are you sure?
    When you add the multi-page attachment to your email only the first page shows. If you click on that first page to select it and then right click and choose Quick Look Attachemnt you should be able to see that all pages are there.
    Matt

  • Attaching HTML file and sending through mail

    Hi
    My Requirement is
    I want to attach HTML File and send through mail id's.
    But there are number of html files
    user can select any  one file.
    it has to attach and send to the mail id.

    Hi V,
    check the link:
    http://wiki.sdn.sap.com/wiki/display/Snippets/SendEmailwithHTMLattachment.

  • Problem reading attached PDF files

    <!--[if gte mso 9]><xml>
    </xml><![endif]--><!--[if gte mso 9]><xml>
    Normal
    0
    false
    false
    false
    MicrosoftInternetExplorer4
    </xml><![endif]--><!--[if gte mso 9]><xml>
    </xml><![endif]--><!--[if !mso]>
    <object
         classid="clsid:38481807-CA0E-42D2-BF39-B33AF135CC4D" id=ieooui>
    </object>
    <style>
    st1\:*{behavior:url(#ieooui) }
    </style>
    <![endif]-->
    <!--[if gte mso 10]>
    <style>
    /* Style Definitions */
    table.MsoNormalTable
    {mso-style-name:"Table Normal";
    mso-tstyle-rowband-size:0;
    mso-tstyle-colband-size:0;
    mso-style-noshow:yes;
    mso-style-parent:"";
    mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
    mso-para-margin:0cm;
    mso-para-margin-bottom:.0001pt;
    mso-pagination:widow-orphan;
    font-size:10.0pt;
    font-family:"Times New Roman";
    mso-ansi-language:#0400;
    mso-fareast-language:#0400;
    mso-bidi-language:#0400;}
    </style>
    <![endif]-->
    Hello.
    At my work, we use JavaMail (version 1.4.1) in server
    programs, processing mails with attached files from customers. Mostly it is
    TIFF images, but it can also be PDF
    files, and the attached files are extracted and saved for further processing.
    Sometimes, we have a problem, reading attached PDF
    files. The files get saved, but is of size 0 bytes. If I forward it, however,
    using an Outlook client, the forwarded item can be read by our JavaMail program, and files saved OK.
    I have tried to forward it using JavaMail, but I cannot
    compose the mail parts, that fails, however - of the same reasons: I cannot
    read the them in:-)
    It looks like it's when the mail is send from a Mac.
    Anyway, the part to read is of content type "APPLICATION/APPLEFILE" whereas when it's forwarded, it's content
    type is "APPLICATION/OCTET-STREAM"
    The way, I read the part, is to check if the part is an
    instance of an InputStream, and then saving into a byte array, like this:
    h5. Object
    obj = part.getContent();
    if (obj instanceof
    InputStream) {
    InputStream
    inStream = part.getInputStream();
    byte[]
    buffer = new byte[BUFFER_SIZE];
    int
    bytesRead;
    BufferedOutputStream
    outBufStream = new BufferedOutputStream(new FileOutputStream(attFileName));
    while
    ((bytesRead = inStream.read(buffer)) != -1)
    outBufStream.write(buffer,
    0, bytesRead);
    inStream.close();
    h5. outBufStream.close();
    Problem
    is that .read() method always returns -1 when content type Is APPLICATION/APPLEFILE,
    so a file of 0 bytes are created.
    Interesting is perhaps, that debugging shows me that the
    part instance of the InputStream actually is a
    com.sun.mail.util.BASE64DecoderStream when it fails, and a
    com.sun.mail.util.QPDecoderStream
    when it works OK.
    So I have this idea, that I's a certain type of decoder
    stream we're missing? We use Java 1.6.0 update 10 and JavaMail 1.4.1. and since
    we use java 1.6 we use the JAF framework from that one, I guess?
    Hope you guys can help?
    Thanks in advance, Per Jensen
    [email protected]

    We have two (MS Exchange) servers (from trace log):
    Microsoft Exchange IMAP4rev1-server version 5.5.2650.23
    Microsoft Exchange Server 2003 IMAP4rev1 server version 6.5.7226.0
    - the first one is the one, we're using here, but I have tried on the other, newer version too, and it didn't help either.
    But I've found out a couple of interesting things:
    1: Debugging shows me, that the part instance of the InputStream actually is a com.sun.mail.util.BASE64DecoderStream when it fails, and if I forward the mail via Outlook as described earlier, and it can be read OK, the part is a com.sun.mail.util.QPDecoderStream instance.
    2: I can save the WHOLE message to a file, using message.getInputStream(), and when I opens the file I can find the individual attachments - as well as the bodytext, if any - as they are separated with the disposition, mimetype and filename fields, showed as plain text. And the attachments are showed as blocks of characters; I guess it's the ascii character representation of the bytes. Here's a snippet, note the first two sentences. They seemes to be added, somehow, when I dump the message to file(?):
    <START OF DUMPED FILE>
    This message is in MIME format. Since your mail reader does not understand
    this format, some or all of this message may not be legible.
    ------_=_NextPart_000_01C9A8A2.19479FE4
    Content-Type: text/plain;
         charset="iso-8859-1"
    Content-Transfer-Encoding: quoted-printable
    (The body text here)
    ------_=_NextPart_000_01C9A8A2.19479FE4
    Content-Type: application/applefile;
         name="first_attachment.pdf"
    Content-Transfer-Encoding: base64
    Content-Disposition: attachment;
         filename="first_attachment.pdf"
    AAUWAAACAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAIAAAASgAAABAAAAAJAAAAWgAAACAAAAADAAAA
    egAAABAAAAABAAAAigAAI6IAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
    AAAAAAAAAAA1NzE2NSBCTkhhdWcucGRmJVBERi0xLjMKJbe+raoKMSAwIG9iago8PAovVHlwZSAv
    Q2F0YWxvZwovUGFnZXMgMiAwIFIKPj4KZW5kb2JqCjIgMCBvYmoKPDwKL1R5cGUgL1BhZ2VzCi9L
    aWRzIFsgNCAwIFIgXQovQ291bnQgMQo+PgplbmRvYmoKMyAwIG9iago8PAovUHJvZHVjZXIgKEhh
    ...(and so on)
    DMgMDAwMDAgbg0KMDAwMDAwNTM1NSAwMDAwMCBuDQowMDAwMDA2NTA5IDAwMDAwIG4NCjAwMDAw
    MDc2NjUgMDAwMDAgbg0KdHJhaWxlcgo8PAovUm9vdCAxIDAgUgovSW5mbyAzIDAgUgovU2l6ZSAx
    MQo+PgpzdGFydHhyZWYKODgyNAolJUVPRgo=
    ------_=_NextPart_000_01C9A8A2.19479FE4
    Content-Type: application/applefile;
         name="second_attachment.pdf"
    Content-Transfer-Encoding: base64
    Content-Disposition: attachment;
         filename="second_attachment.pdf"
    AAUWAAACAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAIAAAASgAAABAAAAAJAAAAWgAAACAAAAADAAAA
    egAAABAAAAABAAAAigAAI9wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
    AAAAAAAAAAA1NzE4MSBCTkhhdWcucGRmJVBERi0xLjMKJbe+raoKMSAwIG9iago8PAovVHlwZSAv
    Q2F0YWxvZwovUGFnZXMgMiAwIFIKPj4KZW5kb2JqCjIgMCBvYmoKPDwKL1R5cGUgL1BhZ2VzCi9L
    ...(and so on)
    <END OF DUMPED FILE>I understand that it's base64 encoded and must be decoded, and I have tried to copy/paste the blocks separately, run them through the com.sun.mail.util.BASE64DecoderStream, and saving them as PDF files, which works fine(!).
    As the solution seems to be painfull: Parse the mail to find where the attachments starts and stops and saving them as files, I hope you guys can send me on the right track?
    PS: The trace log when dumping the file shows everything OK, I think. Here's a bit of the log at the end of dumping the message:
    (...)MTUgMDAwMDAgbg0KMDAwMDAwNTg2NyAwMDAwMCBuDQowMDAwMDA3MDIxIDAwMDAwIG4NCjAwMDAw
    MDgxNzcgMDAwMDAgbg0KdHJhaWxlcgo8PAovUm9vdCAxIDAgUgovSW5mbyAzIDAgUgovU2l6ZSAx
    MQo+PgpzdGFydHhyZWYKOTMzNgolJUVPRgo=
    ------_=_NextPart_000_01C9A8A2.19479FE4--
    A10 OK FETCH fuldført.
    A11 FETCH 1 (BODY[TEXT]<40336.16384>)
    * 1 FETCH (BODY[TEXT]<40336> {0}
    20/03-09 15:18:21,445 3 Done, writing bytes to ByteArrayOutputStream. Size: 40336 bytes (..common.mail.MailUtil.dumpMessageToFile.dumpMessageToFile)
    20/03-09 15:18:21,445 3 Done, writing ByteArrayOutputStream to file. (..common.mail.MailUtil.dumpMessageToFile.dumpMessageToFile)
    A11 OK FETCH fuldført.

  • Can't view PDF files in Mail

    After the 10.5 upgrade I can no longer view PDFs in Mail. Not sure if this is also due to the install of Adobe CS3, however now PDFs just show as a "mime-attachment" which do not display in any other app. Other 10.5.1 users can view these email attachments just fine.
    Is there a way to re-enable PDF files in Mail.app, so that mails with PDF files are displaying within mail.app correctly?

    Yes, I can view emails it is the PDF files I can't download or view.  In OS 4 I could touch the attachment and it would open up, now when I touch the attachment it just tries to download.  This is for all PDF files in gmail.

  • How to attach pdf in e-mail?

    How can I attach pdf-files saved on my phone in an e-mail? Can attach pictures only.

    Hi,
    Although you cannot include other files than pictures in the standard email app, there is another way that does not require OneDrive and is very flexible. It uses the Files app (Microsofts own version) and has the "Share" operation as its central approach. After installation of this app (which is very handy anyway) take the following steps:
     With the files app, create a folder (and call it for example "Email Attachments") and put any combination of documents in there that you want to include in a new mail (you cannot add to an existing mail). You can use the Files app to copy/move folders in any way you like (contrary to IOS and Android, WP has a complete file structure)
    Select this folder (or alternatively: select all files in this folder)
    Then press the "Share" button at the bottom of the screen in the options menu: now your own regisrered email adresses show up (among all other sharing options)
    Select one of your registered email adresses: a new email with this adress as the sender is created and all documents are already attached
    Write/copy the email text, the header and add the address of the recipient (can be done quickly with the +button if the recipient is in your People list), then you are ready to send it.
    Although I agree that the email app should include the option to attach any kind of document, the above approach works very well and is very flexible too and centers around the well-implemented sharing process. Do not forget to collect the documents as described above before writing the email text ...
    BR, Nexhmije

  • Cant attach multiple files in mail

    How to attach multiple files in mail?? 

    Hey demo..
    When I create a document in 'Pages' app I can mail that file from 'Pages' app. But I cant attach multiple .doc file in one mail. For sending multiple files in a single mail I need to do several mails. Is there any system or 3rd party software through which I can attach multiple .doc files in one mail.
    Thanks in advance.

  • Issue the send attach Pdf file in Email. (Urgent).

    Hello folks, i have issue with attach pdf in e-mail using two lib&acute;s: activation.jar and mail.jar. Currently using a platform SOA and am creating the serviceType, then a file don&acute;t is local and yes by message, so far so good.
    Already tried in several forums, but without success.
    When send the message (pdf file), the program receive a type ContentType (application/octet-stream) and cause the MessageException, below:
    MessageException - in Container:
    Message: [B@79ffb7f7  /// the service received the pdf file
    [09/03/02 12:22:45] ID=dev_ESBTest (info) application/octet-stream *///ContentType of message*
    javax.mail.SendFailedException: Sending failed; *///Exception*
    nested exception is:
    javax.mail.MessagingException: IOException while sending message;
    nested exception is:
    **javax.activation.UnsupportedDataTypeException: no object DCH for MIME type application/octet-stream**
    at javax.mail.Transport.send0(Transport.java:219)
    at javax.mail.Transport.send(Transport.java:81)
    javax.mail.MessagingException: IOException while sending message;
    nested exception is:
    javax.activation.UnsupportedDataTypeException: no object DCH for MIME type application/octet-stream
    at com.sun.mail.smtp.SMTPTransport.sendMessage (SMTPTransport.java:353)
    at javax.mail.Transport.send0 (Transport.java:164)
    at javax.mail.Transport.send(Transport.java:81)
    With this, it send the e-mail without attach......above my source simple source code.
    ServiceType Code:
         protected void SendEmail(XQPart prt, String host, String from, String to) {
              // create some properties and get the default Session
              Properties props = System.getProperties();
              props.put("mail.smtp.host";, host);
              Session session = Session.getInstance(props, null);
              try {
                   // create a message
                   MimeMessage msg = new MimeMessage(session);
                   msg.setFrom(new InternetAddress(from));
                   InternetAddress[] address = { new InternetAddress(to) };
                   msg.setRecipients(Message.RecipientType.TO, address);
                   msg.setSubject("Test Subject.");
                   MimeBodyPart bp1 = new MimeBodyPart();
                   bp1.setText("Test Text.");
                   MimeBodyPart bp2 = new MimeBodyPart();
                   m_xqLog.logInformation(prt.getContentType());
                   bp2.setContent(prt.getContent(), prt.getContentType());
                   bp2.setFileName("teste.pdf";);
                   Multipart mp = new MimeMultipart();
                   mp.addBodyPart(bp1);
                   mp.addBodyPart(bp2);
                   msg.setContent(mp);
                   msg.setSentDate(new Date());
                   Transport.send(msg);
                   System.out.println("Email sent successfully!");
              } catch (MessagingException mex) {
                   mex.printStackTrace();
                   Exception ex = null;
                   if ((ex = mex.getNextException()) != null) {
                        ex.printStackTrace();
         }Anybody would can help me, please....
    Thanks ....
    Paulo Sampei.

    Hello Folks, me again. Then the solution about this question above, below:
    Solution:
    Code 1: Call 2 method passing requirement parameter:
    Obs: Always ContentType = application/octet-stream
    ByteArrayInputStream attachStream = new ByteArrayInputStream((byte[]) prt.getContent());
    //call constructor class:InputStreamDataSource
    InputStreamDataSource isds = new InputStreamDataSource("Testepdf.pdf", prt.getContentType(),attachStream);
    //call method sendMail(InputStreamDataSource,host,from,to)
    sendMail(isds, s_Host, s_SendFrom, s_SendTo);Code 2: Class InputStreamDataSource
         // statement DataSource
         private class InputStreamDataSource implements DataSource {
              private String name;
              private String contentType;
              private ByteArrayOutputStream baos;
              InputStreamDataSource(String name, String contentType,
                        InputStream inputStream) throws IOException {
                   int read;               
                   this.name = name;
                   this.contentType = contentType;
                   baos = new ByteArrayOutputStream();
                   byte[] buff = new byte[256];               
                   while ((read = inputStream.read(buff)) != -1) {
                        baos.write(buff, 0, read);
              public String getContentType() {
                   // TODO Auto-generated method stub
                   return contentType;
              public InputStream getInputStream() throws IOException {
                   // TODO Auto-generated method stub
                   return new ByteArrayInputStream(baos.toByteArray());
              public String getName() {
                   // TODO Auto-generated method stub
                   return name;
              public OutputStream getOutputStream() throws IOException {
                   // TODO Auto-generated method stub
                   throw new IOException("Cannot write to this read-only resource");
         }Code 3: mehod sendMail(InputStreamDataSource, host, from, to)
         protected void sendMail(InputStreamDataSource attach, String host,
                   String from, String to) {
              // create some properties and get the default Session
              Properties props = System.getProperties();
              props.put("mail.smtp.host", host);
              Session session = Session.getInstance(props, null);
              try {
                   // create a message
                   MimeMessage msg = new MimeMessage(session);
                   msg.setFrom(new InternetAddress(from));
                   InternetAddress[] address = { new InternetAddress(to) };
                   msg.setRecipients(Message.RecipientType.TO, address);
                   msg.setSubject("Assunto teste.");
                   // create and fill the first message part
                   MimeBodyPart bp1 = new MimeBodyPart();
                   bp1.setText("Texto teste.");
                   // create the second message part
                   m_xqLog.logInformation("[ContentType]:[attach] "
                             + attach.getContentType());
                   // attach the file to the message
                   MimeBodyPart bp2 = new MimeBodyPart();
                   bp2.setDataHandler(new DataHandler(attach));
                   bp2.setFileName(attach.getName());
                   // create the Multipart and add its parts to it
                   Multipart mp = new MimeMultipart();
                   mp.addBodyPart(bp1);
                   mp.addBodyPart(bp2);
                   // add the Multipart to the message
                   msg.setContent(mp);
                   // set the Date: header
                   msg.setSentDate(new Date());
                   // send the message
                   Transport.send(msg);
                   System.out.println("Email sent successfully!");
              } catch (MessagingException mex) {
                   mex.printStackTrace();
                   Exception ex = null;
                   if ((ex = mex.getNextException()) != null) {
                        ex.printStackTrace();
         }Thank you very much, forum and bshannon at your tips.
    Cheers,
    Paulo Sampei.

Maybe you are looking for