public static void printMessage(Message message)
	{
		try
		{
			// Get the header information
			String from = ((InternetAddress) message.getFrom()[0])
					.getPersonal();
			if (from == null)
			{
				from = ((InternetAddress) message.getFrom()[0]).getAddress();
			}
			System.out.println("FROM: " + from);
			String subject = message.getSubject();
			System.out.println("SUBJECT: " + subject);
			// -- Get the message part (i.e. the message itself) --
			Part messagePart = message;
			Object content = messagePart.getContent();
			// -- or its first body part if it is a multipart message --
			if (content instanceof Multipart)
			{
				messagePart = ((Multipart) content).getBodyPart(0);
				System.out.println("[ Multipart Message ]");
			}
			// -- Get the content type --
			String contentType = messagePart.getContentType();
			// -- If the content is plain text, we can print it --
			System.out.println("CONTENT:" + contentType);
			if (contentType.startsWith("text/plain")
					|| contentType.startsWith("text/html"))
			{
				InputStream is = messagePart.getInputStream();
				BufferedReader reader = new BufferedReader(
						new InputStreamReader(is));
				String thisLine = reader.readLine();
				while (thisLine != null)
				{
					System.out.println(thisLine);
					thisLine = reader.readLine();
				}
			}
			System.out.println("-----------------------------");
		}
		catch (Exception ex)
		{
			ex.printStackTrace();
		}
	}