Rev 5128 | Rev 5140 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
package in.shop2020.catalog.util;import in.shop2020.utils.GmailUtils;import java.io.ByteArrayOutputStream;import java.text.DateFormat;import java.text.SimpleDateFormat;import java.util.Date;public class ReportSender implements Runnable {@Overridepublic void run() {ReportGenerator repGen = new ReportGenerator();ByteArrayOutputStream baos = repGen.generateExcelStream(ReportGenerator.TYPE_BOTH);if(baos != null){GmailUtils gm = new GmailUtils();DateFormat dateFormatter = new SimpleDateFormat("yyyy.MM.dd");String[] recepients = {"cnc.center@shop2020.in, ashutosh.saxena@shop2020.in, chaitanya.vats@shop2020.in"};String subject = "Items that require your attention.";String from = "cnc.center@shop2020.in";String password = "5h0p2o2o";String fileName = "items."+ dateFormatter.format(new Date()) + ".xls";byte [] bytes = baos.toByteArray();try {gm.sendSSLMessage(recepients, subject, "PFA", from, password, fileName, bytes, "application/xls");} catch (Exception e) {e.printStackTrace();}}}}