Reading mime types other than text

Is there a way to parse out text from mime types (other than text). I am using the following code for getting content of emails but it gives a "class not found exception" when the email content is something other than pure ascii text or if the email has attachments.
Message messages[]=folder.getMessages();
int nummessages=folder.getMessageCount();
System.out.println((String)((MimeMessage)messages[nummessages-1]).getContent()).
Also can anyone provide any direction on how to seperate out the mail body from attachments.
thanks for any help
ronjon

Hi!
Maybe the following is helping...
First call: this.processEvaluateContenttype(((MimeMessage)messages[nummessages-1]).getContent());
     protected void processEvaluateContenttype(Object aObject){
          try{
             if(aObject instanceof Multipart){
                 Multipart aMultiContent = (Multipart) aObject;
//                    Traverse every part of the multipart-content...                         
                    for(int contentIndex=0; contentIndex < aMultiContent.getCount(); contentIndex++){
                         this.processEvaluateContenttype(aMultiContent.getBodyPart(contentIndex));                       
             }else if(aObject instanceof BodyPart){
                 BodyPart aBodyContent = (BodyPart) aObject;                                 
                    StringTokenizer aTypeTokenizer = new StringTokenizer(aBodyContent.getContentType(), "/");
                    String abstractType = aTypeTokenizer.nextToken();                     
                    if(abstractType.equals("MESSAGE") || abstractType.equals("message")){
                         Message inlineMessage = (Message)aBodyContent.getContent();        
                         this.processEvaluateContenttype(inlineMessage.getContent());
//                    Specific tryouts....
                    }else if(abstractType.equals("APPLICATION") || abstractType.equals("application")){
//                         Get name of attachment...
                         String fileName = aBodyContent.getFileName();     
//                         Check name of attachment...
                         if((null != fileName)
//                                      do somthing
         }catch(Exception ex){
              super.errorManager.handleError("MailBot | Task_ContractState", ex);
               super.isResponsible.isResponsible = false;
     }     This method is in daily use and works fine... The "abstractType" you are looking for is bw "TEXT" and "text":

Similar Messages

  • Mail does not recognize outgoing server for Forwards or content other than text

    Since installing Mountain Lion Mail has been erratic.  It generally will not send mail that I Forward nor will it send mail that includes links, graphics photos, etc.  It sends original mail consisting of text only without a problem.  When I try to Forward mail, or send new mail that includes content over and above text, I get the following result:
    None of the options will send the mail.   If I “Try With Selected Server”, I go into an endless loop – click on it, get the same Cannot Send… window back.  “Try Later” merely puts the message into my Outbox where it sits – and sits.  It will sit there for days if I let it.  If I sooner or later try to send it, I get the above Cannot Send… window again.  If I “Edit the Message”it still will not send. The Connection Doctor tells me that the mail account is logged in and connected without a problem.  If I “Edit SMTP Server List” I get Mail Preferences – the edit SMTP list window – and no SMTP servers listed – blank list.  Yet the Mail account has the proper iCloud SMTP server in its set-up.  Moreover, text only emails send without a hitch.  I can readily send them before, during and after the “Cannot Send…” window pops up for an email that has other than text included in its content.
    Interestingly, if I put the problem email into my Draft mailbox and then go online and log-in to my iCloud account, I can then open the email in iCloud online and send it – and it sends without a pause or quibble. Why won’t it send through Mail on my computer???
    NONE of this happened in Lion. 

    Some of the threads related to this one that I found (none provides a solution):
    On apple.com:
    * IMAP Folders (http://discussions.apple.com/message.jspa?messageID=6406947#6406947)
    * Exchange email folders and sub-folders: iPhone only pulling main "inbox" (http://discussions.apple.com/message.jspa?messageID=6406941#6406941)
    * IMAP - How to poll sub-folders (not GMAIL/Yahoo) (http://discussions.apple.com/message.jspa?messageID=6406940#6406940)
    * Mail not checking for new messages in IMAP subfolders (http://discussions.apple.com/message.jspa?messageID=6406938#6406938)
    * Imap Slow or not responsive (http://discussions.apple.com/message.jspa?messageID=6406937#6406937)
    * Iphone Mail Only Shows "Load X More Messages" (http://discussions.apple.com/thread.jspa?messageID=6407082#6407082)
    * IMAP: Only updates Inbox? (http://discussions.apple.com/thread.jspa?messageID=6407083#6407083)
    * Any way to get the mail app to get updated message counts for other folders (http://discussions.apple.com/thread.jspa?messageID=6407118#6407118)
    Elsewhere:
    * Help iphone mail subfolders IMAP (http://forums.macrumors.com/showthread.php?t=391027)

  • FM to create support message for custom process type other than 'SLFN'

    Hi All
    Is there any function module or BAPI which will create support message for the custom process type other than SLFN.
    BAPI_NOTIFICATION_CREATE is posting only for the process type 'SLFN'
    Thanks in advance
    Regards
    Ravi

    Any ideas?

  • Oui is valid but for a machine type other than current

    Hi all,
    I am installing SAP ERP 6 on a Windows 2008 r2 server. I have Intel Xeon CPUs 64bits. However, as I start "oracle Universal Installer" (ou)i on it, I got a message that says "that oui is valid but for a machine type other than current". I guess is beacuse of the CPU, but I am not completely sure,
    Thank you in advanced for your help

    Same question of thread:
    http://scn.sap.com/message/13352961

  • Some pdf files cannot be read by eReaders other than Acrobat

    I have several books in pdf format.  All, including the attached, read perfectly in Acrobat and all, except the attached, read perfectly in various eReaders.  The attached file, however, cannot be read by any reader other than Acrobat and cannot be imported into Calibre and converted to any other format.
    What is unique about this file?
    I can not find any way to attach the file.  Please post instructions.
    Using Windows 8, Adobe Reader X 10.1.8,

    You cannot attach PDF files to the forum, only images (e.g. screen shots) and not at all in an email reply.
    To share a PDF put it on acrobat.com, your own web site, or a file sharing site, and reply with the URL.
    What does Adobe Reader X say for Document Security (under File > Properties)? The SECURITY METHOD is the key information. You are quite correct that some PDF files use security methods which lock them to Acrobat.

  • How to set focus on field having data type other than character(eg. NUMC)

    Hello all,
    I have developed one screen having table control inside. In table control suppose if numeric type field is blank(eg. Employee number of data type NUMC), system should throw error message and should put cursor focus on that perticular filed. In the same table control for fields of data type 'CHAR',  I have done this using 'SET CURSOR FIELD' .
    Please, suggest me how to set cursor focus on the fileds of data type other that character(eg. NUMC)

    Have you tried it?  SET CURSOR FIELD ... works fine for type 'N' fields in a table control.  The restriction is 'character-type' and 'flat'.  Type 'N' (or NUMC-like) fields are both.

  • Want to install reader 11 in other than C:  So far no hints/suggestions/links etc have worked

    Simply trying to install adobe reader 11 on windows 8.1 in  other than drive C. So far all hints/links/wizards/suggestions have failed.
    Its becoming rather frustrating as this should be simple. Other vendors make this very easy.
    thanks

    It is pretty simple but depends on how you're trying to install. If you are trying to install from "Adobe Reader Install for all versions" (follow the link) then you won't get option to customize your install. If you want customization then you should download the installer and install using it. You can download the installer directly from "ftp://ftp.adobe.com/pub/adobe/reader/win/11.x/11.0.10/en_US/AdbeRdr11010_en_US.exe".
    Once downloaded you can simply double click the downloaded exe and it will first extract the installer and then show you another dialog that contains a button saying "Change destination folder..". Use this button to change install directory.
    OR
    Alternatively you can use the below command line to install:
    AdbeRdr11010_en_US.exe /msi INSTALLDIR="<PATH to the folder>"
    Some people already suggested that you use "msiexe /i install file" - but you were unable to fine the install files.The MSI and other installation files are packaged into the exe above. If you double click and run the exe above then it will extract all the required files under "C:\ProgramData\Adobe\Setup\{AC76BA86-7AD7-1033-7B44-AB0000000001}" folder on your machine. You can then use the MSI file in customization Wizard to make customization you want. Customization Wizard only works with MSI files and it won't accept exe.
    Last but not the least "Seems like the only way to do this is to install it, then move it to where one wants it, the edit the registry and hope one doesn't screw it up. Not a good option IMHO". I can assure you that you'll screw it up. Don't do this.

  • Not able to read other than text files

    Hi,
    I am trying to read a set files in a folder, but i am able to read only test files all other file format cannot be read. word document is not read correctly!
    I use fileInputstream object and get the bytes of the file length and set the charset to "UTF-8". the output is like a junk data.
    I feel i need to set the exact charcterset, but donot no how, can any body help me out.
    i tried character.unicodeblock.of this is not returning the exact uincode( may be i am wrong)
    Thanks in advance.

    Don't read binary files as though they were text.
    Also if you are just copying files, you shouldn't even bother to read text files as text, unless you want to go beyond copying and, say, change the encoding.
    [http://java.sun.com/docs/books/tutorial/essential/io/index.html]

  • Gatewaying and adaptive tags expansion in content types other than html

    I notice that the default configuration of the portal does not transform adaptive tags / URLs when the content type is Javascript (ie I am gatewaying a .js file loaded from a <javascript src=&#034;..&#034;/> tag  in which I want some transformations).  Is there a configuration option which determines what file types / content types are transformed which I can set to get transformation in my .js files?

    The problem stems from the fact that ProductInformationView_Browse.jsp is blindly executing the <jbo:ViewCriteria> tag on each page rendering.
    Internally, the view criteria tag is issuing an executeQuery() on the view object, and this basically sets the current record pointer back to zero. This is why we're never able to scroll more than one page full beyond the initial page full.
    I fixed the problem by making the <jbo:ViewCriteria> tag
    execute conditionally based on the lack of presence of the jboEvent parameter.
    I added the following snippet before the <jbo:ViewCriteria> tag...
    <%
    String jboEvent = request.getParameter("jboEvent");
    if (jboEvent == null || jboEvent.equals("")) {
    %>
       <jbo:ViewCriteria id="vc" datasource="ds" action="new">And the following snippet after the closing tag:
       </jbo:ViewCriteria>
    <% } %><%-- end if --%>And this then allows me to scroll next and previous as expected.
    I'll try to have the author of this sample fix its source code so others don't hit this problem.

  • Other Audio Types other than "Music" are discriminated!

    Hi,
    1. Any other Audio types which are not music, like podcasts or audio books are not set to play automatically when clicking on the headset to start playing.
    2. When putting iPhone in Landscape mode, Albums of Audio books don't Appear.
    3. The Artists and Album list of Audio books are empty.
    Why are full features supported only for "music" and not for audio books and podcasts, etc. ?
    Thanks

    Well...
    1) On my 3G, podcasts and audiobooks are controllable with the heasdset control just as music is.
    2) When you are playing a podcast/audiobook, that one will appear in the landscape/coverflow view. The others do not, admittedly, but is it a bid issue? - not for me.
    3) Podcasts and audiobooks are listed in their own categories - easier to find that way than they would if lumped together with my music.

  • Any other alternate data type other than "P"

    Hi All
    Can any body tell me any other data type that has a feild length more than 16 with decimal 0.

    Use this
    data: a type DEC_25.

  • Required attribute does not work with any data type other than String

    sir,
    I am a new to JSF. My problem is that I have used an integer type data in my page which is taking its value from a bean.But in jsf code I have used the required attribute for the <h:inputText> but if I leave the text box empty it is not showing the validation error which it show show. Another problem is that the page is also not navigating to the next page.
    The code is
    <h:inputText value="#{UserBean.age}" required="true"/>
    where age is of integer type

    Well. The fact that it is not jumping to the next view is "works as required". The assumption is, that once you say a field is required, it could be that the application CANNOT function without that value. Therefor the initial view is redisplayed until all required values are entered.
    IF you need a different behaviour, then the OptionalValidator-package which is currently in development state, is the way to go. It allows to specify different validating strategies for different links on a view (no validation, soft validation (== allow to go on, but produce warning messages), hard validation (== the way JSF works right now)). The problem is that with JSF 1.1 it is quite difficult to implement this behaviour. For simple validators (no parameters) it is working, but for complex validators (requiring parameters) not yet. For more info: http://wiki.apache.org/myfaces/OptionalValidationFramework
    No comment on the String-only behaviour, as I have not yet tested/observed that problem...
    hth
    Alexander

  • How to get internal order and activity type other than from BSEG

    We want the Internal order and activity type fields. From BSEG, it is taking a long time, and it hangs.
    Is there any other table we can get these values from?
    Our query is this:
    select bukrs "Company code
    gjahr "Fiscal year
    belnr "Document no.
    buzei "Document Item no.
    aufnr "Internal order
    lstar "Activity type
    from bseg
    into table gt_add_info
    for all entries in gt_gl_detail
    where bukrs = gt_gl_detail-rbukrs"Comcode from G/L acct detail
    and buzei = gt_gl_detail-buzei "Doc item no. from G/L acct detail
    and belnr = gt_gl_detail-belnr "Doc no. G/L acct detail
    and gjahr = gt_gl_detail-gjahr."Fiscal yea
    Can advise please how to make it faster. My internal table (GT_GL_DETAIL) has over 100000 records. ? thanks.

    I did a SQL trace, and saw that tables CSLA, CSSL, COKL and COKA are being hit with the values I entered inthe Activity type in transaction FB50.
    Still not clear but where it gets stored. If in any of these tables, how do I get the object key?

  • Using an Exchange Rate Type other than 'M' in a Purchase Order

    I use several exchange rate types in SAP for various currency positions, specificially with pricing. 
    As a result, when I create a Purchase Order I want to use a different Exchange Rate Type, instead of the standard 'M'.  I have seen the rates can be placed directly in the Purchase Order, but I would like the system to look up the required rate using a specific exchange rate type.
    Can anyone provide any suggestions or guidance based on prior experiences ?
    thanks
    gino ruggiero

    Dear Gino Ruggiero,
    The MM functionality always uses the "M" rate.
    Not able to release Purchase doc.
    Regards,
    Naveen.

  • Drop-Down, what else can be inserted other than text

    Hello,
    I have a requirement, where I need to insert Group UI Element (this will show the details of what ever I select on the table row). Is it possible?. So that the pop-up wont occupy any space, and it will be closed if I move away from the drop-down.
    Also,
    Can I insert an image in the drop-down?. Does anybody know, whether can we expect these features in coming releases of Web Dynpro?.
    I appreciate your help.
    Thanks,
    Sunita.

    Hi,
    Group UI Element: The Group UI element is a UI element container and can be used to group multiple UI elements under one common title.
    <a href="http://help.sap.com/saphelp_nw70/helpdata/en/78/b38841349e1909e10000000a155106/frameset.htm">How to Use Group UI Element</a>
    DropDownBox : U cannot insert Image in DropDownBox
    In DropDownBox they are two types,for more details see below,
    <a href="http://help.sap.com/saphelp_nw70/helpdata/en/dd/b0884118aa1709e10000000a155106/frameset.htm">DropDownByIndex</a>
    Code Example:
    http://help.sap.com/saphelp_nw70/helpdata/en/95/93fe1e71a2e44691b1f041e67f71aa/frameset.htm
    [url=http://help.sap.com/saphelp_nw70/helpdata/en/c5/e4884180951809e10000000a155106/frameset.htm]DropDownByKey[/url]

Maybe you are looking for