i am developling a mail client using java mail API. I am having problem in reading mail having image file as attachment. I my programme it displays binary sought code.
The binary data is what you get. Your should be able to tell what sort of data it is by examining the "mime-type" of the attachment. After that it's up to your code to decide what to do with it. The answer is not simple, because an email attachment can contain any type of object, not just images. You have to consider what to do if the attachment is a known internally renderable type (say some plain text, or a simple image), a known externally renderable type (say a web page, or some other mime type reprsenting data for an installed application), or a completely unknown or unrenderable type (data for an application you don't have, a movie for which you don't have the codec etc.) Look at how other mail clients and browsers handle the configuration of this for ideas.