Getting attachments and emails need serious help!!

I am not sure if I am doing this right, but I am trying to receive emails from gmail, and I am having some serious problems. For some reason I get four emails and then I get a null exception. I have been through my code a dozen times and I cannot find the problem. Here is my code:     try{
                    Properties props = new Properties();
                    props.setProperty("mail.pop3.socketFactory.class", SSL_FACTORY);
                    props.setProperty("mail.pop3.port", "995");
                    props.setProperty("mail.pop3.socketFactory.port", "995");
                    Session session = Session.getInstance(props, null);
                    Store store = session.getStore("pop3");
                    store.connect("pop.gmail.com", "jwheat3300", "carrie11");
                    Folder folder = store.getFolder("INBOX");
                    folder.open(Folder.READ_ONLY);
                    int n=folder.getMessageCount();
                    attach = new String[n];
                    String select = "false";
                    String body = "";
                    for(int i=1; i<=n; i++)
                         Message message = folder.getMessage(i);
                         date2 = "3/2/2006";
                         from = message.getFrom()[0];
                         subject = message.getSubject();
                         attach="false";
                         Multipart multipart = (Multipart)message.getContent();
                         int j = multipart.getCount();
                         for(int l=0; l<j; l++)
                              Part part = multipart.getBodyPart(l);
                              disposition = part.getDisposition();
                              System.out.println(disposition);
                              if((disposition !=null) && ((disposition.equalsIgnoreCase(Part.ATTACHMENT) || disposition.equalsIgnoreCase(Part.INLINE))))
                                   MimeBodyPart mbp = (MimeBodyPart)part;
                                   if(mbp.isMimeType("text/plain"))
                                        body = (String)mbp.getContent();
                                        if(body==null)
                                             body="";
                                        bodies.add(new Body(body));
                                   if(mbp.isMimeType("text/html"))
                                        body = "This is an html email. Unable to display HELP";
                                        bodies.add(new Body(body));
                                   if(mbp.isMimeType("application/x-shockwave-flash"))
                                        attach[i] = "true";
                                   System.out.println(part.getContentType());
                              if(disposition == null)
                                   MimeBodyPart mbp = (MimeBodyPart)part;
                                   if(mbp.isMimeType("text/plain"))
                                        body = (String)mbp.getContent();
                                        if(body==null)
                                             body="";
                                        bodies.add(new Body(body));
                                        attach[i] = "false";
                                   if(mbp.isMimeType("text/html"))
                                        body = "This is an html email. Unable to display HELP";
                                        bodies.add(new Body(body));
                                        attach[i] = "false";     
                         inmails.add(new Inmail(select, from, subject, date2, attach[i]));
                         table.revalidate();
                    folder.close(false);
                    store.close();
               }catch(Exception t)
                         System.err.println("Exception900: " +t.getMessage());
I get the body fine, and what I am trying to do is when I get all of my information is to put this into the inmails vector and then update my table. That works but I am only gettting four of thirty emails. Also when it comes to attachments do I need to set up a mime type for every possible attachment that will come? I need some serious help!

I guess I am seriously confused then....I tried doing the tutorial from jguru on sun's site and this was how the code was set up. At least I think it is....I pretty much have no idea what I am doing. I mean the code as it stands will get the emails, and by the way this is for an application not for a server or anything. So should I check for it to be just plain text first and then find out if there is a multipart. There is not really any good tutorials that explain what it is I am trying to accomplish. Please help!

Similar Messages

  • My ipad is disabled and i need serious help to get it open again.

    I have an ipad 1 that I downloaded an app on and pressed a lot of buttons and then my iPad was locked. I cant unlock it so how do i reboot it when the computer i usually use with it is not currently working? I really need help!
    Thx in advance,
         Abigail

    I don't know if you will find this helpful but you can take a look.
    http://www.tech-faq.com/itunes-network-connection-timed-out.html
    Make sure you have the latest version of iTunes and turn off your firewall and antivirus software and then try again to restore.
    If you can connect but you are still unable to restore, you can try recovery mode.
    http://support.apple.com/kb/ht4097

  • Can't get into OSX! Need serious help here!

    So I've seen some folks have had this problem but I haven't found a solution in any previous posts about this. Anyway, I have a bootcamped MBP. Everything has worked fine for the past 3 months but today I restarted my computer, booted to Windows, did some stuff there, restarted and booted to OSX. I got to the blue screen and the "Starting OSX" box popped up for a quick second and then dissappeared, leaving me with a pointer and a blank blue screen. I've tried everything I've seen in other posts about this. It does the same thing when I boot in safe mode as well. I booted up in verbose mode and it stops on the login app. I booted to the install disk and reselected the Mac HD to no avail. Windows still boots fine and it boots to disk fine, but refuses to start up OSX. Is there a way to reinstall OSX without losing my 3+ months of data that I've aquired? That would suck so bad to lose everything on my HD. ANY help would be appreciated. Thanks for reading!

    Restart with the left Shift key held down and see if you can get to the login window; if you can't, perform an Archive and Install of Mac OS X, which won't delete items you've added to the computer. If you can get to the login window, restart with the Command and S keys held down. Enter the following:
    mount -uw /
    cd /Users
    mv username/ olddata/
    exit
    Replace username with the short name of your account in line 3, unless you've moved your home folder, in which case you will need to change the paths in lines 2 and 3; your computer should then start up and log in, but your account's data will have been reset to the defaults. To get your data back, open the Users folder on your hard disk followed by olddata, and then drag documents and other items outside of the Library/Preferences/ folder to your current home folder. One of the items in Library/Preferences/ was likely responsible for the issue.
    If you are able to get to the login window but can't log in after moving your home folder, reset the NetInfo database and then move the entire home folder, including Library/Preferences/, to the current home folder.
    (14823)

  • My first BB 8310 and I NEED SERIOUS HELP....

    Is there any BBA (BlackBerry Anonymous) meetings in my area. Had it a week and I'm addicted already. Don't know how I lived without it!! **bleep** you who ever invented it!! 

    vino2216 wrote:
    I actually do have a quick question which probably should of included in the original post. Does anyone think there will be a software update anytime soon that stops the messages from automatically opening for us crack heads who can't wait one minute before pulling out our berries from our holsters?
    See, that just flies in the face of true addiction and assimilation. You aren't addicted. Yet.
    But no, I haven't heard of an anti-email opening application. Could be part of the conspiracy against us, so watch out.
    Message Edited by JSanders on 01-13-2009 11:40 AM
    1. If any post helps you please click the below the post(s) that helped you.
    2. Please resolve your thread by marking the post "Solution?" which solved it for you!
    3. Install free BlackBerry Protect today for backups of contacts and data.
    4. Guide to Unlocking your BlackBerry & Unlock Codes
    Join our BBM Channels (Beta)
    BlackBerry Support Forums Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

  • I lost all email 6months and older in mac mail. Need Serious Help!

    I lost all email 6 months and older in mac mail. In my in-box as a well as all other folders I created. I expected that the mac email software would keep all email as it did for me in when I used to use Outlook. As well I thought I was covered with the Time Machine I have installed. Well.....The Time Machine that I was aggressively encouraged to buy apparently doesn't back up email. If it does, I must need some secret decoder ring to unlock where it is. I need serious help. I lost months of professional and personal data. I need to fix this immediately and find some way to get my email back. Please help.

    In March when I upgraded to Lion and iCloud I also experienced a similar problem (cluster of problems) which was solved by a password reset (conforming to new requirements) for my Apple ID. I'm glad to see that many nice people contributed and your primary problem is fixed.  My comment is on your Quicken problem.
    Your data inside Quicken 2004 is on borrowed time.  In the process of researching personal budgeting apps I found many reports on the web that indicate Intuit as a company is scaling down Quicken (desktop) development and its future attention to the Mac platform will be minimal.
    Did you know that Intuit is behind Mint.com?  You may be hesitant to put your financial data "in the cloud" and I may be being sheepish, but.. bbaaaa, bbaaaaa, the cloud is where it's going.  I know first-hand want a pain in the arse it is to customize an app to your liking.  I spent several hours on Mint.com setting up categories and tagging transactions.  It's tedious. I didn't look because I wasn't a Quicken user, but perhaps Intuit was nice enough to provide a data conversion path for Mint.com.  It is worth a look.
    My second suggestion is to scour the web for a hack solution.  You can't be the only person who is facing this problem.  Quicken was very popular.  I just bet someone has posted directions or some code for exporting the Quicken 2004 data and manipulating it for something else.
    Good Luck.
    Ellee H.

  • I need serious help please.. We do translations of schoolbooks, I looked for an over-type function but were unable to find, we are working in indesign CS 5. it takes up allot of time to delete text and type in the new language.

    I need serious help please.. We do translations of schoolbooks, I looked for an over-type function but were unable to find, we are working in indesign CS 5. it takes up allot of time to delete text and type in the new language.

    Argh that's frustrating! I never noticed that key did not work in InDesign.
    A bit of research and it turns out the MS Office has this as an option in their software. But I cannot find an option in InDesign preferences to make this work.
    However, somethings are not listed in the shortcuts and preferences and are hidden triggers in InDesign which can be accessed through a script.
    I'm not saying it's possible to activate the Insert Key through a script, but it's plausible that it can be activated.
    Maybe ask on the scripting forum? InDesign Scripting
    I know this may be a possibility as with InDesign's earlier versions of PDF export to interactive documents there previously was no way to export interactive pdfs as single pages if in Spreads.
    But the option to toggle this setting was scriptable.

  • HT5312 I have forgotten the answers to my apple security questions. I have tried several times but just cant get through and I need to make a purchase for the first time

    I have forgotten the answers to my apple security questions. I have tried several times but just cant get through and I need to make a purchase for the first time

    I am having the same problem. I know my apple ID and password but do not remember my security questions. How do you go about changing the security questions? Please help.
    Thanks.

  • Cold boot problem with X-FI Fata1ty card... Need serious help!

    Hey guys:
    I just finished upgrading my computer. Realized that I have a cold boot problem. In order to identify the source of problem. I began the following test.
    . Remove everything except, cpu, heatsink, ram, video card. Tried to boot with those devices. => No cold boot problem.
    2. Install the rest of the ram sticks (I have 4 x 52 in total). => No cold boot problem.
    3. Install the other video card (my setup is 7900gtx in SLI) => No cold boot problem.
    4. Install the Creative X-FI Fataty card. => COLD BOOT PROBLEM
    Once the computer is shut down via the front power switch on the case, the computer will not boot again. To boot the computer, I need to switch off the main power switch on the back of the psu and switch it back on; then turn on the computer via the front power switch on the case. I tried the problem with and without the sound card. Whenever the sound card is installed. There is the problem. If there is no that sound card in my rig, then there won't be any cold-boot problem.
    My rig specs:
    DFI Lanparty nF4 SLI-DR Venus
    AMD Opteron 65 CCBE 609 - Stock speed
    4 x 52 MB G.Skill Samsung TCCD LE 2.85V DDR 400
    CPU Cooling - Tuniq tower 20
    2 x EVGA 7900 GTX Stock - SLI
    3 x WD Raptor 74G RAID-0 SATA (-3) 0000 rpm (System)
    x Seagate Barracuda 7200.7 60Gb 7200RPM NCQ SATA - 4 (Backup)
    Pioneer Black DVR 0 DVD+/-RW - IDE /0
    Lian-li PC-V 200B Plus-2 with little case mod
    OCZ GameXstream 600W
    Creative Fatalty Sound Card w/ Front Panel
    Logitech Z5500 5. speakers
    I need serious help. This problem is so annoying.
    Tnanks and will greatly appreciate it.Message Edited by White_Hair on 0-27-200605:4 PM

    The onboard sound is disabled. Unfortunately I sold the Seasonic PSU to my friend. The OCZ GameXStream is suppose to be the higher grade psu than Seasonic PSU. Also, the cold boot problem only exists if the sound card is plugged to the motherboard. I tried change different pci slot. It doesn't seem to help the problem. Thanks for the reply Message Edited by White_Hair on 2-02-200606:07 AM

  • HT4623 Hi there , I have ipone3GS it is locked and I need your help to unlocke it as soon as possible .

    Hi there ,
    I have ipone3GS it is locked and I need your help to unlocke it as soon as possible .
    IMEI :  01 299500 378415 1
    I am waiting for your help for unlocke it to use it soon .
    Thank you for understanding my situation .
    Regards
    Sultan Alsharari

    Could you please give me their email to contact them.
    I am waiting for your replay .
    Thank you
    Sultan Alsharari

  • Need serious help over here...

    Hi guys...need serious help...I am using nokia lumia 710 for the past 3months...today i tried to reset my phone,but after resetting my phone dint restart...it keeps on rebboting after the WINDOWS PHONE screen apears...So i need some help...i tried pressing power on,camera and volume up and down button to reset again...but nothing happening...if i charge the phone it does the same...plz help me

    Did you try removing the Battery for a couple of minutes, insert back and see if it makes any difference ? If no change then you need to visit Nokia Care

  • Someone is using faebook to run java script to get data and email from me in windows 8

    someone is using faebook to run java script  to get  data  and  email  from  me in  windows  8

    Is this a developer question?
    Jeff Sanders (MSFT)
    @jsandersrocks - Windows Store Developer Solutions
    @WSDevSol
    Getting Started With Windows Azure Mobile Services development?
    Click here
    Getting Started With Windows Phone or Store app development?
    Click here
    My Team Blog: Windows Store & Phone Developer Solutions
    My Blog: Http Client Protocol Issues (and other fun stuff I support)

  • HT1277 i just updated with the new update and now cannot get into my email.  please help!

    i just updated with the new apple update and now cannot get into my email.  i get an error message that i tried to open mail version 4.5 and cannot in apple os x  please help!

    This happened because if Mail.app was moved from /Applications or placed in a sub-folder there, the update (Security Update 2012-004) couldn't find it and fails for writing new files to Mail. This update updates Mail 4.5 to 4.6, consequently the message that 4.5 is incompatible, since it's looking at the now "old" 4.5 version. See the thread linked below for a fix and some other possible workarounds.
    https://discussions.apple.com/thread/4311280?tstart=0
    Basically, make sure Mail.app is in the Applications folder inside the Macintosh HD folder, and sitting by itself not in an enclosing folder. Then get the update from Apple Downloads   and run that again.

  • HT1848 I tried the above recommendations but my music did not transfer from my ipod touch to my new pc. there are over 465 songs and music videos I purchased on itunes that will be lost if I can not get this rectified. Need additional help on this..

    How do I transfer my content on my ipod touch to a new pc.  My old pc crashed and the ipod does not recognize the reboot. Content includes old music cds that I got rid of and itunes purchases that I could not transfer to my new pc, (ALL PAID FOR).  I've been unable to sync because I do not want to lose over 465 songs and videos.  Please help.
    joe

    The following user tip is worth checking through:
    Recovering your iTunes library from your iPod or iOS device

  • Battery Recall (Need Serious Help)

    Hi all,
    I have a Black Macbook (July 06).
    My battery for the last 3 weeks has been horrid. My computer lasts a total of 1.5 hours under min. brightness and no serious workload. And the worst part is, it just shuts off, doesn't sleep when it gets low. Just totally turns off.
    Now my cycle count is at 299 and I have no idea what to do with this thing. I took it out of my computer because I honestly believe I deserve a replacement.
    So I called my local service center here in Lebanon (middle east) and this is what they told me.
    Since I purchased my Macbook from Canada (I had to move to Lebanon in August 06) they cannnot, and will not replace my battery for me. Even if I requested to pay the shipping charges.
    Is there any help for me? I feel they are shafting me because they've done this with my iBook which had the recall battery fire issue. And another iBook which had a manufacturer defect. In anycase, those I fixed when I went back to Canada. But I can't keep these 299 cycles forever! Can someone seriously help me here?

    I know, I was hoping someone could point me in the right direction.
    Maybe you know of an email where I can send my complaint? Because all I can find are 1800 numbers that don't connect when dialing internationally.

  • Hi  I'm having trouble in question No. secret and secret answer and I need to help

    Hi
    I'm having trouble in question No. secret and secret answer and I need to help

    Hello alamri 2014,
    Thanks for the question. It sounds like you wish to reset your security questions. The following resources may assist you in doing so:
    Apple ID: All about Apple ID security questions
    http://support.apple.com/kb/HT5665
    What should I do if I don't remember the answers to my Apple ID security questions?
    Try answering them at least once to see if you can get them right, even if you are not sure you remember the answers to your security questions.
    If you are confident you can't remember them, try one of the following:
    If you have three security questions and a rescue email address
         - sign in to My Apple ID and select the Password and Security tab to send an email to your rescue email address to reset your security questions and answers.
    If you have one security question and you know your Apple ID password
         - sign in to My Apple ID and select the Password and Security tab to reset your security question.
    If you have one security question, but don't remember your Apple ID password
         - contact Apple Support for assistance. Learn more about creating a temporary support PIN to help Apple confirm your identity when you contact Apple Support.
    If you do not see the option for resetting your questions with a rescue email address, see this excerpt:
    Note: The option to send an email to reset your security questions and answers will not be available if a rescue email address is not provided. You will need to contact iTunes Store support in order to do so.
    Rescue email address and how to reset Apple ID security questions
    http://support.apple.com/kb/HT5312
    Additional Information:
    Apple ID: Contacting Apple for help with Apple ID account security
    http://support.apple.com/kb/HT5699
    Thanks,
    Matt M.

Maybe you are looking for