email.setContent(contentBuffer.toString()); if (charset != null) { email.setCharset(charset);
/** * Send the report through email. * * @param attachment the file containing the report * @param numberOfBitstreams the number of bitstreams reported * @throws IOException if IO exception occurs * @throws MessagingException if message cannot be sent. */ public void sendReport(File attachment, int numberOfBitstreams) throws IOException, javax.mail.MessagingException { if (numberOfBitstreams > 0) { String hostname = ConfigurationManager.getProperty("dspace.hostname"); Email email = new Email(); email.setSubject( "Checksum checker Report - " + numberOfBitstreams + " Bitstreams found with POSSIBLE issues on " + hostname); email.setContent("report is attached ..."); email.addAttachment(attachment, "checksum_checker_report.txt"); email.addRecipient(ConfigurationManager.getProperty("mail.admin")); email.send(); } }