How do you display an attachment file using the JavaMail package?

John Zukowski

The JavaMail API provides no mechanism to display attachments. It is up to you to decide how you want to display something.

For instance, if your attachment is a Microsoft Word file, and you happen to be on a Windows box, you can use Runtime.exec() to fork off a process to display the file in Microsoft Word. If your attachment is a text file, you can put the contents in a read-only JTextArea. Either way, how to display is outside the realm of the JavaMail API.