Hi Gary,
If I use the following printMessage method:
public static void printMessage(Message message)
{
try
{
for (Enumeration e = message.getAllHeaders();
e.hasMoreElements(); ){
System.out.println("Headers: "+ e.nextElement());}
if (message.getAllHeaders() != null)
System.out.println("Got headers for the received emails"+
message.getHeader("Content-Type"));
// -- 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("I got a Multipart Message!");
}
}
With deug off, output is
Got headers for the received emails null
With debug on, the output is
DEBUG: JavaMail version 1.3.1ea
DEBUG: java.io.FileNotFoundException:
C:\JBuilder9\jdk1.4\jre\lib\javamail.providers (The system cannot find the
file specified)
DEBUG: !anyLoaded
DEBUG: not loading resource: /META-INF/javamail.providers
DEBUG: successfully loaded resource: /META-INF/javamail.default.providers
DEBUG: Tables of loaded providers
DEBUG: Providers Listed By Class Name:
{com.sun.mail.smtp.SMTPTransport=javax.mail.Provider[TRANSPORT,smtp,com.sun.
mail.smtp.SMTPTransport,Sun Microsystems, Inc],
com.sun.mail.imap.IMAPStore=javax.mail.Provider[STORE,imap,com.sun.mail.imap
..IMAPStore,Sun Microsystems, Inc],
com.sun.mail.pop3.POP3Store=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3
..POP3Store,Sun Microsystems, Inc]}
DEBUG: Providers Listed By Protocol:
{imap=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Sun
Microsystems, Inc],
pop3=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun
Microsystems, Inc],
smtp=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun
Microsystems, Inc]}
DEBUG: successfully loaded resource: /META-INF/javamail.default.address.map
DEBUG: !anyLoaded
DEBUG: not loading resource: /META-INF/javamail.address.map
DEBUG: java.io.FileNotFoundException:
C:\JBuilder9\jdk1.4\jre\lib\javamail.address.map (The system cannot find the
file specified)
DEBUG: getProvider() returning
javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun Microsystems,
Inc]
DEBUG POP3: connecting to host "mailsrv11-pop3.siteserver.net", port 110
S: +OK POP3 server ready <11186512.1514841515@mailsrv11>
C: USER (e-mail address removed)
S: +OK Please send PASS
C: PASS ***********
S: +OK User mailbox has 1 message (1361 octets)
C: STAT
S: +OK 1 1361
Got headers for the received emailsnull
C: RETR 1
S: +OK
Received: from [24.192.49.141] by mailsrv11.siteserver.net [63.203.180.102]
with SmartMax MailMax for (e-mail address removed); Fri, 24 Oct 2003
10:06:55 -0700
Return-Path: <
[email protected]>
Message-ID: <009801c39a6b$27a419f0$cf00a8c0@wg014>
From: "Qiang Zhao" <
[email protected]>
To: "Qiang Zhao" <
[email protected]>
Subject: I am glad
Date: Fri, 24 Oct 2003 13:12:30 -0700
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary="----=_NextPart_000_0095_01C39A30.7A9727A0"
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 5.50.4807.1700
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
This is a multi-part message in MIME format.
------=_NextPart_000_0095_01C39A30.7A9727A0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
------=_NextPart_000_0095_01C39A30.7A9727A0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.3502.5390" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV> </DIV></BODY></HTML>
------=_NextPart_000_0095_01C39A30.7A9727A0--
C: QUIT
S: +OK
It seems that from field appeared in the deug mode. How do you think?
Thank you very much, Gary.