我可以成功通过Java Mail API发送电子邮件,但现在我正在尝试发送从带有边框等格式的表中的MySQL查询填充的ResultSet的内容,我可以使用CSS标签来执行此操作吗?如果是这样的话?
我的代码如下:
public void getOutstanding() throws MessagingException {
try {
String outS = "SELECT period_to, type, amt, status FROM tblinstall "
+ "WHERE status like ?";
PreparedStatement update = toDB.prepareStatement(outS);
email = new StringBuilder();
email.append("<html><head><style type='text/css'>table .out {border-width:1px, "
+ "border-color: black}</style></head>"
+ "<body>"
+ "<table class'out'><span style=border-color: black, border-width: 1px>");
update.setString(1, "Outstanding");
ResultSet results = update.executeQuery();
while (results.next()) {
System.out.println("in results...");
email.append("<tr>");
email.append("<td>");
long period = results.getLong("period_to");
email.append(DateConvert.fromEpoch(period));
email.append("</td>");
email.append("<td>");
email.append(results.getString("type"));
email.append("</td>");
email.append("<td>");
email.append(results.getString("amt"));
email.append("</td>");
email.append("<td>");
email.append(results.getString("status")); …Run Code Online (Sandbox Code Playgroud)