contentType = temp.toLowerCase();
	public MessageParser(BufferedReader in, PrintWriter out, String file)							throws IOException,							MessageParseException {		file = file.substring(0, file.length() - 5);		MessageHeaderParser mhp = new MessageHeaderParser();		mhp.parse(in);		out.println("<html>");		out.println("<body>");		out.println("<table>");		if (mhp.getHeaderField("Date") != null) {			DateParser dp = new DateParser();			dp.setTargetFormat(YAMM.getString("longdate"));			String date = null;			try {				date = dp.parse(mhp.getHeaderField("Date"));			} catch (ParseException pe) {				date = "";			}			out.println("<tr><td>" + YAMM.getString("mail.date") +				"</td><td>" + date + "</td></tr>");		}		if (mhp.getHeaderField("From") != null) {			String from = makeClickable(mhp.getHeaderField("From"));			out.println("<tr><td>" + YAMM.getString("mail.from") +				"</td><td>" + from + "</td></tr>");		}		if (mhp.getHeaderField("To") != null) {			String to = makeClickable(mhp.getHeaderField("To"));			out.println("<tr><td>" + YAMM.getString("mail.to") +				"</td><td>" + to + "</td></tr>");		}		if (mhp.getHeaderField("Reply-To") != null) {			String replyto = makeClickable(						mhp.getHeaderField("Reply-To"));			out.println("<tr><td>" + 				YAMM.getString("mail.reply_to") + "</td><td>" +				replyto + "</td></tr>");		}		if (mhp.getHeaderField("Subject") != null) {			out.println("<tr><td>" + 				YAMM.getString("mail.subject") + "</td><td>" +				mhp.getHeaderField("Subject") + "</td></tr>");		}		out.println("</table>");		out.println("<br><pre>");		String boundary = null;		String temp = mhp.getHeaderField("Content-Type");		String contentType = temp.toLowerCase();		if (temp != null) {			if (temp.indexOf("boundary=\"") != -1) {				boundary = temp.substring(					temp.indexOf("boundary=\"") + 10,					temp.indexOf("\"",					temp.indexOf("boundary=\"") + 11));			}		}		if (mhp.getHeaderField("MIME-Version") != null) {			// expect a little mime message			for (;;) {				if (boundary != null) {					if (in.readLine().equals("--" +								boundary)) {						new Attachment().parse(in,						null);						break;					}				} else {					break;				}			}		}		MessageBodyParser mbp = new MessageBodyParser(true);		for (;;) {			int test = mbp.parse(in, out, boundary);			if (test == MessageBodyParser.ATTACHMENT &&							contentType.indexOf("multipart/alternative") == -1) {				Attachment a = new Attachment();				PrintWriter AtOut = new PrintWriter(						new BufferedOutputStream(						new FileOutputStream(file +							".attach." +							attachments)));								for (;;) {					// Attachment found					test = a.parse(in, AtOut);					if (test == Attachment.MESSAGE &&							contentType.indexOf("multipart/alternative") == -1) {						break;					} else if (test == Attachment.							ATTACHMENT) {						attachments++;						AtOut.close();						AtOut = new PrintWriter(new							BufferedOutputStream(							new FileOutputStream(								file +								".attach." +								attachments)));						continue;					} else /* if (test == Attachment.END) */{						return;					}				}			} else if (test == MessageBodyParser.END) {				// end reached				break;			} else if (test == MessageBodyParser.ATTACHMENT) {				break;			}		}		out.println("</pre></body>");		out.println("</html>");	}