我有一个实用程序,可将每日报告创建为Excel工作表,其中包含处理失败的文件的详细信息,然后向用户发送邮件,此代码用Java编写。
当失败文件的值为0
时,邮件将发送空白而不是0
。
这是示例代码
//sample piece of code
String bodyText = "<html>"
+ "<body style =\"font-family: Calibri; font-size:11pt; background-color:white \">"
+ "<table style =\"border:1px solid black;background-color:#DBE5F1;width:100%\">"
+ "<tr style = \"background-color:#DBE5F1 ;text-align-left; font-size:11pt\">"
+ "<br>"
+ "  Hi All,"
+ "</br>"
+ "<br>"
+ statusLine
+ "</br>"
+ " "
+"<br>"
+ "</tr>"
+ "<td style = \"text-align:right;width:10%;border-right:1px solid black\">"
+ caseCreated
+ "</td>"
+ "<td style = \"width:10%;border-right:1px solid black;text-align:right\">"
+ Failure
+ "</td>"
+"</html>";
//and for composing the mail message
message.setContent(bodyText, "text/html");