e.printStackTrace();
}
}
private void sendApprovalRequest(Comment comment) {
Blog blog = comment.getBlogEntry().getBlog();
SimpleDateFormat sdf = new SimpleDateFormat("dd MMM yyyy HH:mm:ss z");
sdf.setTimeZone(blog.getTimeZone());
String subject = MailUtils.getCommentPrefix(blog, comment.getState()) + " " + comment.getTitle();
String author = StringUtils.transformHTML(comment.getAuthor());
if (comment.getWebsite() != null) {
author = "<a href=\"" + comment.getWebsite() + "\">" + author + "</a>";
}
SecurityTokenValidator validator = new SecurityTokenValidatorImpl();
String message = "Comment from " + author + " on " + sdf.format(comment.getDate());
message += " in response to " + comment.getBlogEntry().getTitle();
message += "\n\n<br><br>";
message += comment.getBody();
message += "\n\n<br><br>";
message += "<a href=\"" + comment.getPermalink() + "\">Permalink</a>";
message += " | ";
message += "<a href=\"" + blog.getUrl() + validator.generateSignedQueryString("manageResponses.secureaction",
createMap("response", comment.getGuid(), "submit", "Approve"), blog.getXsrfSigningSalt()) + "\">Approve</a>";
message += " | ";
message += "<a href=\"" + blog.getUrl() + validator.generateSignedQueryString("manageResponses.secureaction",
createMap("response", comment.getGuid(), "submit", "Reject"), blog.getXsrfSigningSalt()) + "\">Reject</a>";
message += " | ";
message += "<a href=\"" + blog.getUrl() + validator.generateSignedQueryString("manageResponses.secureaction",
createMap("response", comment.getGuid(), "submit", "Remove"), blog.getXsrfSigningSalt()) + "\">Remove</a>";
Collection to = getEmailAddresses(comment);
try {
MailUtils.sendMail(MailUtils.createSession(), blog, to, subject, message);