如何使用 Java 从电子邮件正文中提取数据
How to extract data from email body using Java
我能够阅读电子邮件正文。 MimeType 是 text/html。以下是电子邮件正文以及如何从中提取某些信息
Transaction type = Vehicle Client Name = Roja H, Client Mobile
Number = 7418529632
<html>
<head>
<title>
Demo Example
</title>
</head>
<body>
<div class="content">
<p>
Dear User,
</p>
<p>
A Transaction has been created for :
</p>
<p>
<table >
<tr>
<td class="col-heading">Transaction Type </td>
<td>:</td>
<td>Vehicle</td>
</tr>
<tr>
<td class="col-heading">Client Name </td>
<td>:</td>
<td>Roja H</td>
</tr>
<tr>
<td class="col-heading">Client Mobile Number</td>
<td>:</td>
<td>7418529632</td>
</tr>
<tr>
<td class="col-heading">Client Email Address</td>
<td>:</td>
<td>clientAddresss@address.com</td>
</tr>
<tr>
<td class="col-heading">Group</td>
<td>:</td>
<td>Examplegroup</td>
</tr>
</table>
</p>
</div>
</html>
显然你只需要解析 html。你可以自己做,可以使用正则表达式来帮助,也可以使用 jsoup 之类的库来完全解析 html.
我能够阅读电子邮件正文。 MimeType 是 text/html。以下是电子邮件正文以及如何从中提取某些信息
Transaction type = Vehicle Client Name = Roja H, Client Mobile Number = 7418529632
<html>
<head>
<title>
Demo Example
</title>
</head>
<body>
<div class="content">
<p>
Dear User,
</p>
<p>
A Transaction has been created for :
</p>
<p>
<table >
<tr>
<td class="col-heading">Transaction Type </td>
<td>:</td>
<td>Vehicle</td>
</tr>
<tr>
<td class="col-heading">Client Name </td>
<td>:</td>
<td>Roja H</td>
</tr>
<tr>
<td class="col-heading">Client Mobile Number</td>
<td>:</td>
<td>7418529632</td>
</tr>
<tr>
<td class="col-heading">Client Email Address</td>
<td>:</td>
<td>clientAddresss@address.com</td>
</tr>
<tr>
<td class="col-heading">Group</td>
<td>:</td>
<td>Examplegroup</td>
</tr>
</table>
</p>
</div>
</html>
显然你只需要解析 html。你可以自己做,可以使用正则表达式来帮助,也可以使用 jsoup 之类的库来完全解析 html.