开发者

mail reading problem?

i have com.sun.mail.pop3.POP3Message object, in that content i have the following format code,

Delivery has failed to these recipients or distribution lists:

anandnarekar@gmail.coxm

An error occurred while trying to deliver this message to the recipient's e-mail address. Microsoft Exchange will not try to redeliver this message for you. Please try resending this message, or provide the following diagnostic text to your system administrator.

Diagnostic information for administrators:

Generating server: delivery

anandnarekar@gmail.coxm
#< #5.0.0 smtp; 554 5.4.4 [internal] Domain Lookup Failed> #SMTP#

Original message headers:

X-AuditID: ac1ec426-b7b3aae0000036b3-7c-4e3009fd2d34
Received: from SVHJ0032 ( [172.30.1.11开发者_开发知识库])    by svhj0367.ideaconnect.com (Symantec
 Brightmail Gateway) with SMTP id BA.D0.14003.DF9003E4; Wed, 27 Jul 2011
 18:22:13 +0530 (IST)
Message-ID: <1502435725.1311770110726.JavaMail.wasadmin@SVHJ0032>
Date: Wed, 27 Jul 2011 18:05:10 +0530
From: <ebill.mh@idea.adityabirla.com>
To: <anandnarekar@gmail.coxm>
Subject: Your Idea Bill
MIME-Version: 1.0
Content-Type: multipart/mixed;
    boundary="----=_Part_67575_1171670486.1311770110725"
Thread-Topic: rsweb_7202772011060510
X-Brightmail-Tracker: AAAAAQAAAZE= </pre>
> Blockquote

how can I retrieve the value of Thread-Topic?


Loop through the text that gets returned to you and look for "Thread-Topic". Once you find it, you can use the indexOf and substring functions to parse out your topic. Sample code shown below:

E:\jdk1.6.0_23\bin>type Test.java
public class Test
{
  public static void main(String[] args) {
    String str = "Thread-Topic: rsweb_7202772011060510";
    if (str.indexOf("Thread-Topic") != -1) {
      String topic = str.substring(str.indexOf(":") + 2);
      System.out.println(topic);
    }
  }
}
E:\jdk1.6.0_23\bin>javac Test.java

E:\jdk1.6.0_23\bin>java Test
rsweb_7202772011060510
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜