List of usage examples for org.apache.commons.mail EmailAttachment setDescription
public void setDescription(final String desc)
From source file:com.zuora.api.UsageAdjInvoiceRegenerator.java
public static void main(String[] args) { String exportIdPRPC, exportIdII, exportFileIdII, exportFileIdPRPC, queryII, queryPRPC; boolean hasArgs = false; if (args != null && args.length >= 1) { UsageAdjInvoiceRegenerator.PROPERTY_FILE_NAME = args[0]; hasArgs = true;/*from w w w.j a v a 2 s. c o m*/ } AppParamManager.initParameters(hasArgs); if (!AppParamManager.TASK_ID.equals("")) { try { zApiClient = new ApiClient(AppParamManager.API_URL, AppParamManager.USER_NAME, AppParamManager.USER_PASSWORD, AppParamManager.USER_SESSION); zApiClient.login(); } catch (Exception ex) { Logger.print(ex); Logger.print("RefreshSession - There's exception in the API call."); } queryPRPC = AppParamManager.PRPCexportQuery; queryII = AppParamManager.IIexportQuery; exportIdPRPC = zApiClient.createExport(queryPRPC); exportIdII = zApiClient.createExport(queryII); // ERROR createExport fails if (exportIdII == null || exportIdII.equals("")) { Logger.print("Error. Failed to create Invoice Item Export"); //return false; } // ERROR createExport fails if (exportIdPRPC == null || exportIdPRPC.equals("")) { Logger.print("Error. Failed to create PRPC export"); //return false; } exportFileIdII = zApiClient.getExportFileId(exportIdII); if (exportFileIdII == null) { Logger.print("Error. Failed to get Invoice Item Export file Id"); //log.closeLogFile(); //return false; } exportFileIdPRPC = zApiClient.getExportFileId(exportIdPRPC); if (exportFileIdPRPC == null) { Logger.print("Error. Failed to get PRPC Export file Id"); //log.closeLogFile(); //return false; } // get the export file from zuora //zApiClient.getFile(exportFileIdII, exportFileIdTI); /* Logger.print("II export ID: "+exportFileIdII); Logger.print("TI export ID: "+exportFileIdTI); */ Logger.print("Opening Export file"); //Base64 bs64 = new BASE64Encoder(); /* String login = AppParamManager.USER_NAME+":"+AppParamManager.USER_PASSWORD; String authorization ="Basic "+ Base64.encodeBase64String(login.getBytes()); String zendpoint = ""; */ String authorization = ""; //Base64 bs64 = new BASE64Encoder(); if (AppParamManager.USER_SESSION.isEmpty()) { String login = AppParamManager.USER_NAME + ":" + AppParamManager.USER_PASSWORD; authorization = "Basic " + Base64.encodeBase64String(login.getBytes()); } else { authorization = "ZSession " + AppParamManager.USER_SESSION; } String zendpoint = ""; try { /* if( AppParamManager.API_URL.contains("api") ){ //look in api sandbox zendpoint = "https://apisandbox.zuora.com/apps/api/file/"; } else { //look in production zendpoint = "https://www.zuora.com/apps/api/file/"; } */ int index = AppParamManager.API_URL.indexOf("apps"); index = index + 5; zendpoint = AppParamManager.API_URL.substring(0, index) + "api/file/"; Logger.print(zendpoint); //zendpoint = AppParamManager.FILE_URL; //Start reading Invoice Items String zendpointII = zendpoint + exportFileIdII + "/"; URL url = new URL(zendpointII); URLConnection uc = url.openConnection(); //Logger.print("Opening invoice item file: "+exportFileIdII+" authorization: "+authorization); uc.setRequestProperty("Authorization", authorization); InputStream content = (InputStream) uc.getInputStream(); BufferedReader in = new BufferedReader(new InputStreamReader(content)); CSVReader cvsReader = new CSVReader(in); List<String[]> batchOfRawDataList = null; while ((batchOfRawDataList = cvsReader.parseEntity()) != null) { UsageAdjInvoiceRegenerator.readInvoices(batchOfRawDataList, cvsReader.getBatchStartLineNumber(), "InvoiceItem"); } in.close(); String zenpointPRPC = zendpoint + exportFileIdPRPC + "/"; url = new URL(zenpointPRPC); uc = url.openConnection(); uc.setRequestProperty("Authorization", authorization); content = (InputStream) uc.getInputStream(); in = new BufferedReader(new InputStreamReader(content)); cvsReader = new CSVReader(in); while ((batchOfRawDataList = cvsReader.parseEntity()) != null) { UsageAdjInvoiceRegenerator.readInvoices(batchOfRawDataList, cvsReader.getBatchStartLineNumber(), "PRPCItem"); } in.close(); Logger.print("start processing values"); UsageAdjInvoiceRegenerator chargeAdjustment = new UsageAdjInvoiceRegenerator(); int[] results; int totalErrors = 0; String emailmsg = ""; Logger.print("----------------------------------------"); Logger.print("start creating usages"); results = zApiClient.createUsageItems(newUsageCollection); if (results[1] != 0) { emailmsg = (results[0] - results[1]) + "/" + results[0] + " usage creation "; } totalErrors = totalErrors + results[1]; Logger.print("start cancelling invoices"); results = zApiClient.alterInvoices(newUsageCollection, "cancel"); if (results[1] != 0) { emailmsg = (results[0] - results[1]) + "/" + results[0] + " invoice cancellation "; } totalErrors = totalErrors + results[1]; Logger.print("start deleting usages"); results = zApiClient.deleteUsageItems(deleteList); if (results[1] != 0) { emailmsg = (results[0] - results[1]) + "/" + results[0] + " usage deletion "; } totalErrors = totalErrors + results[1]; Logger.print("start regenerating invoices"); results = zApiClient.alterInvoices(newUsageCollection, "generate"); if (results[1] != 0) { emailmsg = (results[0] - results[1]) + "/" + results[0] + " invoice generation "; } totalErrors = totalErrors + results[1]; Logger.print("start deleting old invoices"); results = zApiClient.alterInvoices(newUsageCollection, "delete"); if (results[1] != 0) { emailmsg = (results[0] - results[1]) + "/" + results[0] + " invoice deletion "; } totalErrors = totalErrors + results[1]; // Create the attachment EmailAttachment attachment = new EmailAttachment(); if (totalErrors > 0) { String logFileName = AppParamManager.OUTPUT_FOLDER_LOCATION + File.separator + "runtime_log_" + AppParamManager.OUTPUT_FILE_POSTFIX + ".txt"; attachment.setPath(logFileName); attachment.setDisposition(EmailAttachment.ATTACHMENT); attachment.setDescription("System Log"); attachment.setName("System Log"); } MultiPartEmail email = new MultiPartEmail(); email.setSmtpPort(587); email.setAuthenticator( new DefaultAuthenticator(AppParamManager.EMAIL_ADDRESS, AppParamManager.EMAIL_PASSWORD)); email.setDebug(false); email.setHostName("smtp.gmail.com"); email.setFrom("zuora@gmail.com"); if (totalErrors > 0) { email.setSubject("Base Calc Processor Finished with Errors"); email.setMsg("The base calc processing has finished " + emailmsg + "records successfully."); } else { email.setSubject("Base Calc Processor Finished Successfully"); emailmsg = (results[0] - results[1]) + "/" + results[0] + " invoice "; email.setMsg("The base calc processing has finished " + emailmsg + "records successfully."); } email.setTLS(true); email.addTo(AppParamManager.RECIPIENT_ADDRESS); if (totalErrors > 0) { email.attach(attachment); } email.send(); System.out.println("Mail sent!"); if (hasArgs) { Connection conn = AppParamManager.getConnection(); Statement stmt = conn.createStatement(); DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); java.util.Date date = new Date(); stmt.executeUpdate("UPDATE TASK SET STATUS = 'completed', END_TIME = '" + dateFormat.format(date) + "' WHERE ID = " + AppParamManager.TASK_ID); Utility.saveLogToDB(conn); conn.close(); } } catch (Exception e) { Logger.print("Failure, gettingFile."); Logger.print("Error getting the export file: " + e.getMessage()); //System.out.println("Error getting the export file: "+e.getMessage()); try { Connection conn = AppParamManager.getConnection(); Statement stmt = conn.createStatement(); DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); java.util.Date date = new Date(); stmt.executeUpdate("UPDATE TASK SET STATUS = 'failed', END_TIME = '" + dateFormat.format(date) + "' WHERE ID = " + AppParamManager.TASK_ID); Utility.saveLogToDB(conn); conn.close(); } catch (Exception e2) { // TODO Auto-generated catch block e2.printStackTrace(); } } } else { Logger.print("No tasks in wait status"); } }
From source file:com.github.somi92.seecsk.util.email.EmailSender.java
public static void sendEmail(EmailContainer ec) throws RuntimeException { try {//from w ww . jav a 2s . c o m String user = Config.vratiInstancu().vratiVrednost(Constants.OrgInfoConfigKeys.ORGANISATION_EMAIL); String password = Config.vratiInstancu() .vratiVrednost(Constants.OrgInfoConfigKeys.ORGANISATION_EMAIL_PASSWORD); EmailAttachment ea = new EmailAttachment(); ea.setPath(ec.getAttachmentPath()); ea.setDisposition(EmailAttachment.ATTACHMENT); ea.setDescription("Primer ispravno popunjene uplatnice za ?lanarinu"); ea.setName("uplatnica.pdf"); MultiPartEmail mpe = new MultiPartEmail(); mpe.setDebug(true); mpe.setAuthenticator(new DefaultAuthenticator(user, password)); mpe.setHostName( Config.vratiInstancu().vratiVrednost(Constants.EmailServerConfigKeys.EMAIL_SERVER_HOST)); mpe.setSSLOnConnect(true); mpe.setStartTLSEnabled(true); mpe.setSslSmtpPort( Config.vratiInstancu().vratiVrednost(Constants.EmailServerConfigKeys.EMAIL_SERVER_PORT)); mpe.setSubject(ec.getSubject()); mpe.setFrom(ec.getFromEmail(), Config.vratiInstancu().vratiVrednost(Constants.OrgInfoConfigKeys.ORGANISATION_NAME)); mpe.setMsg(ec.getMessage()); mpe.addTo(ec.getToEmail()); mpe.attach(ea); mpe.send(); } catch (EmailException ex) { ex.printStackTrace(); throw new RuntimeException("Sistem nije uspeo da poalje email. Pokuajte ponovo."); } }
From source file:emailworkshop.EmailWorkshop.java
public static void enviaEmailComAnexo(String mailFrom, String senhaFrom, String emailTo, String nomeTo) throws EmailException { // cria o anexo 1. EmailAttachment anexo1 = new EmailAttachment(); anexo1.setPath("Certificado.pdf"); //caminho do arquivo (RAIZ_PROJETO/teste/teste.txt) anexo1.setDisposition(EmailAttachment.ATTACHMENT); anexo1.setDescription("anexo"); anexo1.setName("Certificado.pdf"); // configura o email MultiPartEmail email = new MultiPartEmail(); email.setHostName("smtp.gmail.com"); // o servidor SMTP para envio do e-mail email.addTo(emailTo, nomeTo); //destinatrio email.setFrom(mailFrom, "UFPR"); // remetente email.setSubject("Certificado II Workshop de Inovao"); // assunto do e-mail email.setMsg("Segue anexo o Certificado de participaao no II Workshop, Obrigado pela presena! \n " + emailTo); //conteudo do e-mail email.setAuthentication(mailFrom, senhaFrom); email.setSmtpPort(465);//from w ww .j a v a 2s. com email.setSSL(true); email.setTLS(true); // adiciona arquivo(s) anexo(s) email.attach(anexo1); // envia o email email.send(); }
From source file:frameworkcontentspeed.Utils.SendEmailAtachament.java
public static void SendEmailSephoraPassedJava(String from, String grupSephora, String subject, String filename) throws FileNotFoundException, IOException { try {//from w w w . j a v a 2 s .c om EmailAttachment attachment = new EmailAttachment(); attachment.setPath(filename); attachment.setDisposition(EmailAttachment.ATTACHMENT); attachment.setDescription("rezultat TC-uri"); attachment.setName("rezultat TC-uri"); MultiPartEmail email = new MultiPartEmail(); email.setHostName("smtp.gmail.com"); email.setSmtpPort(465); email.setAuthenticator(new DefaultAuthenticator("anda.cristea@contentspeed.ro", "testtest")); email.setSSLOnConnect(true); email.addTo(grupSephora); //email.addBcc(grupSephora); email.setFrom(from, "Teste Automate"); email.setSubject(subject); email.setMsg(subject); // add the attachment //email.attach(attachment); StringWriter writer = new StringWriter(); IOUtils.copy(new FileInputStream(new File(filename)), writer); email.setContent(writer.toString(), "text/html"); email.attach(attachment); email.send(); writer.close(); } catch (Exception ex) { System.out.println("eroare trimitere email-uri"); ex.printStackTrace(); } }
From source file:frameworkcontentspeed.Utils.SendEmailAtachament.java
public static void SendEmail(String from, String to1, String to2, String subject, String filename) throws FileNotFoundException, IOException { try {/*from w w w .ja v a2s . co m*/ EmailAttachment attachment = new EmailAttachment(); attachment.setPath(filename); attachment.setDisposition(EmailAttachment.ATTACHMENT); attachment.setDescription("rezultat TC-uri"); attachment.setName("rezultat TC-uri"); MultiPartEmail email = new MultiPartEmail(); email.setHostName("smtp.gmail.com"); email.setSmtpPort(465); //email.setAuthenticator(new DefaultAuthenticator("test@contentspeed.ro", "andaanda")); email.setAuthenticator(new DefaultAuthenticator("anda.cristea@contentspeed.ro", "anda.cristea")); email.setSSLOnConnect(true); email.addBcc(to1); email.addBcc(to2); email.setFrom(from, "Teste Automate"); email.setSubject(subject); email.setMsg(subject); // add the attachment //email.attach(attachment); StringWriter writer = new StringWriter(); IOUtils.copy(new FileInputStream(new File(filename)), writer); email.setContent(writer.toString(), "text/html"); email.attach(attachment); // send the email email.send(); writer.close(); } catch (Exception ex) { System.out.println("eroare trimitere email-uri"); System.out.println(ex.getMessage()); } }
From source file:br.com.colmeiatecnologia.EmailMarketing.model.email.EnviaEmailAnexoModel.java
public void anexar(String caminho, String descricao, String nome) throws EmailException { EmailAttachment attachment = new EmailAttachment(); attachment.setPath(caminho);/*from w w w.j av a 2 s . c o m*/ attachment.setDisposition(EmailAttachment.ATTACHMENT); attachment.setDescription(descricao); attachment.setName(nome); MultiPartEmail.class.cast(email).attach(attachment); }
From source file:com.emo.ananas.reporters.EmailReporter.java
public void report(final String reportName, final File report) { logger.info("send email report {} for {}", reportName, email); Preconditions.checkNotNull(reportName, "report name is required for email reporting"); Preconditions.checkNotNull(report, "report file is required for email reporting"); EmailAttachment attachment = new EmailAttachment(); attachment.setPath(report.getAbsolutePath()); attachment.setDisposition(EmailAttachment.ATTACHMENT); attachment.setDescription(reportName); final String extension; int i = report.getName().lastIndexOf('.'); if (i > 0) { extension = report.getName().substring(i); } else {// w w w . j av a 2 s .c om extension = ""; } attachment.setName(reportName + extension); MultiPartEmail email = new MultiPartEmail(); email.setHostName(sender.smtp); try { for (final String aTo : this.email.to) { email.addTo(aTo); } email.setFrom(this.email.from); email.setSubject(this.email.subject); email.setMsg("Report for " + reportName); email.attach(attachment); email.send(); } catch (EmailException e) { throw new RuntimeException("failed to send email for report " + reportName + " with " + this.email, e); } }
From source file:com.cs.sis.controller.EmailController.java
private EmailAttachment criarAnexo(File anexo, String descricao, String nome) { EmailAttachment attachment = new EmailAttachment(); attachment.setPath(anexo.getAbsolutePath()); //caminho da imagem attachment.setDisposition(EmailAttachment.ATTACHMENT); attachment.setDescription(descricao); attachment.setName(nome);//from w w w . j av a2 s . co m return attachment; }
From source file:fr.gael.dhus.service.job.SendLogsJob.java
@Override protected void executeInternal(JobExecutionContext arg0) throws JobExecutionException { if (!configurationManager.getSendLogsCronConfiguration().isActive()) return;/*from w w w . ja va 2s .co m*/ long start = System.currentTimeMillis(); logger.info("SCHEDULER : Send Administrative logs."); if (!DHuS.isStarted()) { logger.warn("SCHEDULER : Not run while system not fully initialized."); return; } String[] addresses = configurationManager.getSendLogsCronConfiguration().getAddresses().split(","); // Case of no addresses available: use system support if ((addresses == null) || (addresses.length == 0) || "".equals(addresses[0].trim())) { String email = configurationManager.getSupportConfiguration().getMail(); if ((email == null) || "".equals(email)) { throw new MailException("Support e-mail not configured, " + "system logs will not be send"); } addresses = new String[] { email }; } RollingFileAppender rollingFileAppender = (RollingFileAppender) ((org.apache.logging.log4j.core.Logger) LogManager .getRootLogger()).getAppenders().get("RollingFile"); if (rollingFileAppender == null) { throw new MailException("No rolling log file defined"); } String logPath = rollingFileAppender.getFileName(); if ((logPath == null) || logPath.trim().equals("")) { throw new MailException("Log file not defined"); } File logs = new File(logPath); if (!logs.exists()) { throw new MailException("Log file not present : " + logs.getPath()); } Date now = new Date(); SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'@'HH:mm:ss"); df.setTimeZone(TimeZone.getTimeZone("GMT")); String docFilename = configurationManager.getNameConfiguration().getShortName().toLowerCase() + "-" + df.format(now); File zipLogs; try { zipLogs = File.createTempFile(docFilename, ".zip"); } catch (IOException e) { throw new MailException("Cannot create temporary zip log file.", e); } // compress logs file to zip format FileOutputStream fos; ZipOutputStream zos = null; FileInputStream fis = null; try { int length; byte[] buffer = new byte[1024]; ZipEntry entry = new ZipEntry(docFilename + ".txt"); fos = new FileOutputStream(zipLogs); zos = new ZipOutputStream(fos); fis = new FileInputStream(logs); zos.setLevel(Deflater.BEST_COMPRESSION); zos.putNextEntry(entry); while ((length = fis.read(buffer)) > 0) { zos.write(buffer, 0, length); } } catch (IOException e) { throw new MailException("An error occurred during compression " + "logs file, cannot send logs !", e); } finally { try { if (fis != null) { fis.close(); } if (zos != null) { zos.closeEntry(); zos.close(); } } catch (IOException e) { throw new MailException("An error occurred during compression " + "logs file, cannot send logs !", e); } } EmailAttachment attachment = new EmailAttachment(); attachment.setDescription( configurationManager.getNameConfiguration().getShortName() + " Logs " + now.toString()); attachment.setPath(zipLogs.getPath()); attachment.setName(zipLogs.getName()); // Prepare the addresses List<String> ads = new ArrayList<String>(); for (String email : addresses) { StringTokenizer tk = new StringTokenizer(email, ", "); while (tk.hasMoreTokens()) { String token = tk.nextToken().trim(); if (!token.isEmpty()) ads.add(token); } } for (String email : ads) { try { String server = configurationManager.getServerConfiguration().getExternalHostname(); String url = configurationManager.getServerConfiguration().getExternalUrl(); mailServer.send(email, null, null, "[" + configurationManager.getNameConfiguration().getShortName().toLowerCase() + "@" + server + "] logs of " + df.format(now), "Here is attached " + configurationManager.getNameConfiguration().getShortName() + " logs of \"" + url + "\" host.\n\n" + "Kind Regards.\nThe " + configurationManager.getNameConfiguration().getShortName() + " Team.", attachment); logger.info("Logs Sent to " + email); } catch (EmailException e) { throw new MailException("Cannot send logs to " + email, e); } } if (!zipLogs.delete()) { logger.warn("Cannot remove mail attachment: " + zipLogs.getAbsolutePath()); } logger.info("SCHEDULER : Send Administrative logs done - " + (System.currentTimeMillis() - start) + "ms"); }
From source file:de.jaide.courier.TestMessageHandlers.java
/** * Test the message handler for e-mails. * //from w ww . ja v a 2s .com * @throws IOException */ @Test public void testMessageHandlerForEMails_Signup() throws IOException { Map<String, Object> mappedParameters = new HashMap<String, Object>(); /* * Configuration parameters */ // This is the name of the SMTP-configuration, found in the smtp.json, to use for sending the e-mail. mappedParameters.put(MessageHandlerEMail.MAPPING_PARAM_CONFIGURATION_NAME, "info"); // Load the templates using a regular Java classloader, from the folder /email_templates/en/ found in the root of the classpath. mappedParameters.put(MessageHandlerEMail.MAPPING_PARAM_TEMPLATE_PATH, "/email_templates/en/"); mappedParameters.put(MessageHandlerEMail.MAPPING_PARAM_TEMPLATE_PATH_CLASS, this.getClass()); // Or, alternatively, give it a directory path to load the templates from. If possible always stick with the TEMPLATE_PATH_CLASS option. // mappedParameters.put(MessageHandlerEMail.MAPPING_PARAM_TEMPLATE_PATH_FILE, new File("target/classes/email_templates/en/")); // This parameter tells the framework which e-mail templates to use. Here: contact_accept_headers.ftl, contact_accept_subject.ftl // contact_accept_body.ftl.html (if found) and contact_accept_body.ftl.txt (if found). mappedParameters.put(MessageHandlerEMail.MAPPING_PARAM_TEMPLATE_NAME, "contact_accept"); // Send the HTML and the TEXT-version of the e-mail. mappedParameters.put(MessageHandlerEMail.MAPPING_PARAM_TEMPLATE_TYPE, TemplateTypeEnum.BOTH); // The recipient's first name? Used in the e-mail's TO: field. This variable may be accessed in the templates as "recipientFirstname". mappedParameters.put(MessageHandlerEMail.MAPPING_PARAM_RECIPIENT_FIRSTNAME, "Peter"); // The recipient's last name? Used in the e-mail's TO: field. This variable may be accessed in the templates as "recipientLastname". mappedParameters.put(MessageHandlerEMail.MAPPING_PARAM_RECIPIENT_LASTNAME, "Recipientname"); // Who to send the e-mail to? This variable may be accessed in the templates as "recipientEMail". // For testing purposes you should put the actual SMTP-configured sender e-mail address in here mappedParameters.put(MessageHandlerEMail.MAPPING_PARAM_RECIPIENT_EMAIL, "some-email-address@some-domain.tld"); /* * Set the Freemarker-variables for the actual template file. They key names are what they may be referenced as within the Freemarker * templates. */ mappedParameters.put("memberFirstname", "Peter"); mappedParameters.put("memberLastname", "Smith"); mappedParameters.put("memberTitle", "Developer"); mappedParameters.put("memberCompany", "JAIDE GmbH"); mappedParameters.put("memberProfileLink", "http://www.salambc.com/members?id=12345"); mappedParameters.put("memberCompanyLink", "http://www.salambc.com/companies?id=4711"); mappedParameters.put("recipientProfileLink", "http://www.salambc.com/companies?id=54321"); mappedParameters.put("unsubscribeLink", "http://www.salambc.com/preferences/notifications/unsubscribe?id=54321"); /* * Optional step: we want to overwrite the sender's firstname, lastname and e-mail that was configured in the smtp.json. * This is an absolute optional step - you can just go with the sender configured in the smtp.json if it doesn't change on each e-mail * sent out. */ // mappedParameters.put(MessageHandlerEMail.MAPPING_PARAM_SENDER_FIRSTNAME, "Peter Different"); // mappedParameters.put(MessageHandlerEMail.MAPPING_PARAM_SENDER_LASTNAME, "Sendername"); // mappedParameters.put(MessageHandlerEMail.MAPPING_PARAM_SENDER_EMAIL, "peter-different.sendername@mydomain.com"); /* * Send the e-mail */ CourierService.getInstance().getMessageHandlerEMail("/smtp.json").handleMessage(mappedParameters); /* * Send a second e-mail, this time with an attachment. */ List<EmailAttachment> attachments = new ArrayList<EmailAttachment>(); EmailAttachment attachment = new EmailAttachment(); attachment.setPath("target/test-classes/BabyOngBak.jpg"); attachment.setDisposition(EmailAttachment.ATTACHMENT); attachment.setDescription("Picture of Baby Ong Bak"); attachment.setName("BabyOngBak.jpg"); attachments.add(attachment); mappedParameters.put(MessageHandlerEMail.MAPPING_PARAM_ATTACHMENTS, attachments); /* * And now send this e-mail as well. */ System.out.println("Sending out an e-mail to: " + mappedParameters.get(MessageHandlerEMail.MAPPING_PARAM_RECIPIENT_EMAIL) + " using configuration: " + mappedParameters.get(MessageHandlerEMail.MAPPING_PARAM_CONFIGURATION_NAME)); CourierService.getInstance().getMessageHandlerEMail("/smtp.json").handleMessage(mappedParameters); }