How to get An Attachment from(reading outlook attachment from Java)

I am developing a Java Email client. This Email client is working for "POP3" server. This is working fine for recieving all the emails other than Outlook express attachment. This is first time I am posting a topic even I had answered some topics. Now I am expecting your help for to solve this. Please help me if anybody faced the same problem.Please send me the Actuall code retreive Attachment from Inbox
Please Send to me That code
[email protected]

I think this peice of information and code would help u
Getting Attachments
Getting attachments out of your messages is a little more involved then sending them, as MIME has no simple notion of attachments. The content of your message is a Multipart object when it has attachments. You then need to process each Part, to get the main content and the attachment(s). Parts marked with a disposition of Part.ATTACHMENT from part.getDisposition() are clearly attachments. However, attachments can also come across with no disposition (and a non-text MIME type) or a disposition of Part.INLINE. When the disposition is either Part.ATTACHMENT or Part.INLINE, you can save off the content for that message part. Just get the original filename with getFileName() and the input stream with getInputStream().
Multipart mp = (Multipart)message.getContent();
for (int i=0, n=multipart.getCount(); i<n; i++) {
Part part = multipart.getBodyPart(i));
String disposition = part.getDisposition();
if ((disposition != null) &&
((disposition.equals(Part.ATTACHMENT) ||
(disposition.equals(Part.INLINE))) {
saveFile(part.getFileName(), part.getInputStream());
The saveFile() method just creates a File from the filename, reads the bytes from the input stream, and writes them off to the file. In case the file already exists, a number is added to the end of the filename until one is found that doesn't exist.
// from saveFile()
File file = new File(filename);
for (int i=0; file.exists(); i++) {
file = new File(filename+i);
The code above covers the simplest case where message parts are flagged appropriately. To cover all cases, handle when the disposition is null and get the MIME type of the part to handle accordingly.
if (disposition == null) {
// Check if plain
MimeBodyPart mbp = (MimeBodyPart)part;
if (mbp.isMimeType("text/plain")) {
// Handle plain
} else {
// Special non-attachment cases here of
// image/gif, text/html, ...
regards
shanu

Similar Messages

  • How to get the form reference in .js page from .jsp page

    hi
    i have written one form in jsp page omething like:-
    <html:form action="/shopping" onsubmit="return false;">
    can anybody tell me,how to get the form reference in .js page from .jsp page ,
    i have tried:-
    var formRef = document.forms[0];
    butits not working.
    Thanks.

    Its very simple......y cant u prefer google...Bad
    c this example...
    function submit()
    alert("textbox"+ document.forms[0].name.value);//to get textbox value in js
    document.forms[0].submit();//to submit jsp page using js
    <html:html>
    <html:form action="/shopping" onsubmit="submit()">
    <html:text property=name>
    learn to search in google..
    </html:form>
    </html:html>

  • How to get the absolute path of a file from the local disk given the file n

    how to get the absolute path of a file from the local disk given the file name

    // will look for the file at the current working directory
    // this is wherever you start the Java application (cound be C: and your
    // application is located in C:/myapp, but the working dir is C:/
    File file = new File("README.txt"); 
    if (file != null && file.exists())
        String absolutePath = file.getAbsolutePath();

  • How to get safecontrol tag section to a collection from web.config in c#

    how to  get safecontrol tag section to a collection from web.config in c#
    Below is my config file. I need to read the safecontrol tagsection and get all those in to a collection.please help me on this.
    <?xml
    version="1.0"
    encoding="UTF-8"
    standalone="yes"?>
    <configuration>
    <SafeControls>
    <SafeControl
    Assembly="System.Web,
    Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
    Namespace="System.Web.UI.WebControls"
    TypeName="*"
    Safe="True"
    AllowRemoteDesigner="True"
    SafeAgainstScript="False"
    />
    <SafeControl
    Assembly="System.Web,
    Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
    Namespace="System.Web.UI.HtmlControls"
    TypeName="*"
    Safe="True"
    AllowRemoteDesigner="True"
    SafeAgainstScript="False"
    />
    </
    SafeControls>
    </configuration>
    adityadugyala

    Here is the way to read and write custom sections programtically in web.config.
    http://msdn.microsoft.com/en-us/library/2tw134k3.aspx
    Or use the traditional way of reading XML with XMLDocument.
    Bala

  • I wish to use Thunderbird from Reader as Attach to Email

    Hi I would like to send pdfs from Reader using attach to email without using Outlook but using thunderbird instead is this possible? I searched adobe.com for thunderbird but got no hits. I know I am very lazy because I know I can insert the file as an attachment from Thunderbird but there is an option in Reader to Attach to email. I have a new lappie and my trial version of MS Office runs out in 2 weeks but even if I buy Orifice my preferred email client is Thunderbird not outlaw. Any suggestions would be appreciated

    You can change this from the registry, but careful when you edit the registry so you don't mess up things with the system
    Start "regedit", and go to HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Mail double click the (default) value and make sure it displays the correct client (in your case Mozilla Thunderbird). That did the trick for me!

  • How to get string (specified by line and column) from txt file with labview

    Hi everyone
    How to get string (specified by line and column) from txt file with labview
    thx 
    Solved!
    Go to Solution.

    As far as I know, a text file has no columns.  Please be more specific.  Do you mean something like the 5th word on line 4, where words are separated by a space, and lines are separated by a newline character?  You could the Read from Spreadsheet String function and set the delimiter to a space.  This will produce a 2D array of strings.  Then use index array and give the line number and column number.
    - tbob
    Inventor of the WORM Global

  • How to get the first day in the month from a domain date ?

    Hi,
    I like to know how to get the first day in the month from a domain date?
    Thanks
    Stephen

    Hi Gokul...
    Instead of using the funtion module you can just write the 3 statements of code to get the first day of the week.
    Its similar to the above one but instead of writing case statement you can achive the following.
    data : w_res type i,
             w_data type d,
    w_res = w_date mod 7.
    w_date = w_date - w_res.
    write w_date.
    This works.
    Regards,
    Siddarth

  • When plugging in an iPad in Apple Configurator, it is not being read under USB Connected so I can't update it.  Any ideas on how to get the system to read the iPad?

    When plugging in an iPad in Apple Configurator, it is not being read under USB Connected so I can't update it.  The iPhoto window opens up and reads the photos on the iPad, so it is connecting to the computer.  Earlier today I wasn't having any problems.  I have shut down the iPad and the computer and started over, but that didn't help.  Any ideas on how to get the system to read the iPad so I can update the apps on it?

    Hi, is the problem just to update your apps on your iPad? Here is what you should check. Is the iTunes on your computer updated to the latest version? Does your iPad needs to be updated? Do you have enough storage on your iPad to do the update? On your device is your iCloud back up checked?
    Go to Settings - iCloud - Backup/Storage - see if its checked, and try unchecking it before connecting it to the computer.
    Please let me know if you need any further assistance.

  • Anybody know how to get a macbook to read the 4gb it is supposed to be expandable to

    anybody know how to get a macbook to read the 4gb it is supposed to be expandable to

    Providing more info as to exactly which model Mac you have and which type of memory modules you acquired will help us diagnose the problem better.

  • Im connectioning my macbook to my hdmi port in tv.  I am getting no sound through the tv only the macbook speakers.  anyone know how to get my tv to read sound?

    Im connectioning my macbook to my hdmi port in tv.  I am getting no sound through the tv only the macbook speakers.  anyone know how to get my tv to read sound?

    The Mini DisplayPort to HDMI doesn't carry audio unless you have the Mid 2010 model 7,1 and there're no audio plugs on most TVs to work with HDMI since it's expecting audio with the HDMI. But check your TV manual to see if it has audio plugs that work with one of the HDMI ports.
    If you have the Late 2008 model 5,1 Aluminum Unibody or Late 2009 model 6,1 White Unibody with the Mini DisplayPort rather than the Mini-DVI there is an adapter that uses the Mini DisplayPort and a USB port to combine video and audio to HDMI. It's only 2 channel stereo not 5.1 Dolby Surround.
    http://www.monoprice.com/products/product.asp?c_id=104&cp_id=10428&cs_id=1042802 &p_id=5969&seq=1&format=2
    The Mini-DVI port doen't carry audio at all. The Late 2008 model 5,1 Aluminum Unibody and the Late 2009 model 6,1 and Mid 2010 model 7,1 White Unibody have a Mini DisplayPort. The Early 2006 model 1,1 through Early 2008 model 4,1s plus the Early and Mid 2009 model 5,2s have Mini-DVI ports.
    To see which model you have go to the Apple in the upper left corner and select About This Mac, then click on More Info (and then System Report if you’re running 10.7 Lion or 10.8 Mountain Lion). When System Profiler comes up check the Model Identifier and post it back here.

  • How to get G/L account and cost centres from ECC to SRM...

    Dear All,
    How to get G/L account and cost centres from ECC to SRM...
    Please let me know the steps...
    Thanks
    Ravi

    Hi
    GL account - You can define in SPRO- Cross application settings--Account assignment ->Define GL account for product category and account assignment category.
    or you can use BADI BBP_DETERMINE_ACCT.
    In Organisation Strucute - You can Map the backend cost center via KNT  cost center attribute .
    Regards
    Muthu

  • How to read outlook mail using java

    Hi,
    I am new to javamail ,
    I want to read outlook mail using java
    thanks
    Edited by: My_Problems on Jun 20, 2008 11:13 AM

    Hi!
    See Java Api Msgparser in GNU General Public License...
    A parser for .msg Files in Java :
    [http://auxilii.com/msgparser/|http://auxilii.com/msgparser/]
    Use POI... Apache POI - Java API To Access Microsoft Format Files...
    regards,

  • How to get the current path of my application in java ?

    how to get the current path of my application in java ?
    thanks

    To get the path where your application has been installed you have to do the following:
    have a class called "what_ever" in the folder.
    then you do a litte:
    String path=
    what_ever.class.getRessource("what_ever.class").toString()
    That get you a string like:
    file:/C:/Program Files/Cool_program/what_ever.class
    Then you process the result a little to remove anything you don't want:
    path=path.substring(path.indexOf('/')+1),path.lastIndexOf('/'))
    //Might be a little error here but you should find out //quickly if it's the case
    And here you go, you have a nice
    C:/Program Files/Cool_program
    which is the path to your application.
    Hooray

  • How to get Adobe 8 to read entries from Adobe 6

    Some forms that my company uses was created in Adobe version 8. Some employees using adobe pro 6 ignored the message that states "The forms being used were created in a later version of adobe and you need to upgrade to a later version of adobe" and still went ahead and edited the forms with the adobe pro 6.
    Now that everyone is on adobe pro 8 the forms are all showing up blank.
    the information entered using adobe 6 to edit adobe 8 forms are all blank.
    Does anyone have any idea how can recover the information or how to get adobe version 8 to read the entries from version 6.
    Thanks
    Al

    Chances are they did not actually save the entries in AA6. When you open an AA8 document in AA6, you can not edit the document. That may be the issue, not that the made changes (not realizing they were not changed). This could have been avoided if the AA8 folks had saved the form in an AA6 compatible way (Reduce File Size or PDF Optimizer). However, some of the functionality might have been lost with the backward save.
    Assuming you still have AA6 on some machine, try to read them and see if the stuff is there that you are talking about. I doubt that the changes are there.

  • How can i read outlook emails (from my Dell) on my mac?

    Hi!  I have saved all my outlook emails from my PC to a hard drive and want to view them on my macbook.  Do i have to buy the full office/outlook software package or is there another way to read them?
    I have word and xls on my mac from buying the student office package... but want to avoid buying it all again if i can just read the emails on another reader or just buy the outlook email software...
    Thanks
    Graham

    can annyone assist me whit this problem?
    Not without providing more information about the type of email account (POP3, IMAP, or Exchange) and what settings you use in the account

Maybe you are looking for

  • My ipod died at the same time as the external Lacie HD w/ itunes library...

    I have a 30GB video iPod that is just over a year old (barely out of warranty with no applecare!), and I haven't had any trouble with it until about a week ago. I believe it was right after I downloaded the update for my itunes and/ or ipod updating

  • Labview VIs for HP 35670A

    The link to the labview VIs for the HP 35670A is no longer valid and the search for the same returns nothing.  Does anyone have the Labview VIs for that instrument? The last post was back in 2004(see below) The instrument driver for the HP 35670A is

  • PCUI CRM Portal Performance Issues

    Hi Folks, We are using the PCUI CRM Portal. we done the Customized tab, like Product, Customer and Trade Contract Planner. All most all we are used Standard BSP Application, CRM_BSP_Frame. and all class and method also copy from Standard Class, and w

  • Ipod to HiFi

    I have a 30Gb ipod and have it hooked up to the satellite speaker system. I just relocated apartments and now I cannot get any sound out of the stystem. The ipod works OK on earphone and the power is on on the satelite. Can anybody please help me..?

  • BADI or Exit for MFBF Tcode

    Hi Experts, I need to do difference calculation in posting date and document date. I have made the code but not able to find exact BADI or exit for MFBF tcode. BADI i searched - RM_BFLUSH_GOODSMVT EXIT ??? Please suggest, where I have to put below co