alan_turing:
这些应该都是没有问题的。关键在于15行得if始终不成立。为什么?

解决方案 »

  1.   

    那就说明它不是“text/plain ”
    难道是html的?
      

  2.   

    它的确是“text/plain ”,因为我在263上,看过它得原文了,是“text/plain ”。
    如果将15行换成     if (ct.match("text/html"))  依旧没有任何改变。
      

  3.   

    去查RFC文档中关于POP3协议的内容.收取邮件时,附件是被编码为文本在正文后面.所以,你要将正文收下后,才能接受附件.具体去开发文档中参阅POP3协议,关于附件编码问题,可以到RFC查阅相关文档. 祝好运!
      

  4.   

    试试看:
    15:if (ct.match("text/plain")) 
    换成:15: if (ct.match("text/plain;charset=gb2312")) 我看了sina的我的邮件的编码.
    以下是我的一封邮件内容.
    Subject: attach test3
    Date: Sun Nov 12 08:35:28 2000
    X-Mailer: SinaMail 3.0Beta (FireToad)
    X-Priority: 3
    Content-Type: multipart/mixed;
      boundary="----------97401812817428SINAEMAIL---"This is a multi-part message in MIME format.------------97401812817428SINAEMAIL---
    Content-Disposition: inline
    Content-Transfer-Encoding: binary
    <font color=red>Content-Type: text/plain;charset="gb2312"</font>KKK
    ______________________________________
    .
      

  5.   

    又或者换成
      ct.match("text/*")
    这样"text/html","text/plain"都能返回true.以下是j2ee文档:
    public boolean match(java.lang.String s)Match with the specified content-type string. This method compares only the primaryType and subType . The parameters of both operands are ignored.For example, this method will return true when comparing the ContentType for "text/plain" with "text/plain; charset=foobar". If the subType of either operand is the special character '*', then the subtype is ignored during the match. For example, this method will return true when comparing the ContentType for "text/plain" with "text/*"附:pop3 RFC1939
      

  6.   

    谢谢cming,但是问题仍然没有解决。
      

  7.   

    isMimeType
    public boolean isMimeType(java.lang.String mimeType)
                       throws MessagingException
    Is this Part of the specified MIME type? This method compares only the primaryType and subType. The parameters of the content types are ignored. For example, this method will return true when comparing a Part of content 
    type "text/plain" with "text/plain; charset=foobar". If the subType of mimeType is the special character '*', then the subtype is ignored during the comparison.这是JAVADOC,明白了吧。如果是MIMETYPE,那么content type是被忽略的
      

  8.   

    airwin兄:
    我不太理解MIMEtype 和 content type得关系。这段文档,太隐晦了。我不太明白该怎么做。
    但是我看了javamail得demo。这部分问题的处理好象和我付的原代码一样。
      

  9.   

    To spczhou:
      你的coding能不能贴出来,大家分享分享!
      

  10.   

    coding:
    《用javamail显示复合邮件的内容的亲身体会》
    文档中心,这是我的处女作。不妥之处请指教。