Package de.chris_soft.utilities

Examples of de.chris_soft.utilities.SendHtmlMailUtils


  private boolean sendDocumentViaMail(File pdfFile, Properties metadata) {
    if (!Boolean.parseBoolean(AppProperties.getProperty(MailKeys.PROP_KEY_SHALL_SEND_MAIL))) {
      return true;
    }
    SendHtmlMailUtils mail = new SendHtmlMailUtils();
    if (Boolean.parseBoolean(AppProperties.getProperty(MailKeys.PROP_KEY_ADD_DOCUMENT_AS_ATTACHMENT))) {
      mail.addAttachment(pdfFile);
    }
    mail.addTO(AppProperties.getProperty(MailKeys.PROP_KEY_RECEIVER_MAIL_ADDRESS));
    mail.setFrom(AppProperties.getProperty(MailKeys.PROP_KEY_SENDER_MAIL_ADDRESS));
    mail.setLogin(AppProperties.getProperty(MailKeys.PROP_KEY_SENDER_MAIL_ADDRESS));
    mail.setPassword(AppProperties.getProperty(MailKeys.PROP_KEY_SENDER_MAIL_PW));
    mail.setPop3Host(AppProperties.getProperty(MailKeys.PROP_KEY_SENDER_POP3_SERVER));
    mail.setSmtp(AppProperties.getProperty(MailKeys.PROP_KEY_SENDER_SMTP_SERVER),
        Integer.parseInt(AppProperties.getProperty(MailKeys.PROP_KEY_SENDER_SMTP_PORT)));
    String docID = metadata.getProperty(Metadata.DOCUMENT_ID);
    mail.setSubject("::from::OCR:: " + docID);
    String link = "";
    if (Boolean.parseBoolean(AppProperties.getProperty(PROP_KEY_DOCUMENT_SERVER_SHALL_USE))) {
      String serverName = AppProperties.getProperty(PROP_KEY_DOCUMENT_SERVER_NAME);
      String port = AppProperties.getProperty(PROP_KEY_DOCUMENT_SERVER_PORT);
      // String serverMethod = DocumentServer.DOCUMENT_RETRIEVAL_METHOD;
      String serverMethod = new DocumentRetrievalWebsite().getWebsiteName();
      String docParm = WebsiteVariableConstants.varnameDocumentID + "=" + docID;
      String href = "http://" + serverName + ":" + port + "/" + serverMethod + "?" + docParm + "";
      link = "<p><a href=\"" + href + "\">Link zu " + docID + "</a></p>";
    }
    if (Boolean.parseBoolean(AppProperties.getProperty(MailKeys.PROP_KEY_SET_FULLTEXT_INTO_MAIL_BODY))) {
      String fulltext = metadata.getProperty(Metadata.FULLTEXT);
      String htmltext = HtmlFormatter.getHtmlString(fulltext, false, false);
      mail.setText(link + "<p>" + htmltext + "</p>");
    }
    try {
      mail.sendMail();
      return true;
    }
    catch (MessagingException e) {
      LogUtils.log(e);
      return false;
View Full Code Here


  private boolean sendDocumentViaMail(File pdfFile, Properties metadata) {
    if (!Boolean.parseBoolean(AppProperties.getProperty(MailKeys.PROP_KEY_SHALL_SEND_MAIL))) {
      return true;
    }
    SendHtmlMailUtils mail = new SendHtmlMailUtils();
    if (Boolean.parseBoolean(AppProperties.getProperty(MailKeys.PROP_KEY_ADD_DOCUMENT_AS_ATTACHMENT))) {
      mail.addAttachment(pdfFile);
    }
    mail.addTO(AppProperties.getProperty(MailKeys.PROP_KEY_RECEIVER_MAIL_ADDRESS));
    mail.setFrom(AppProperties.getProperty(MailKeys.PROP_KEY_SENDER_MAIL_ADDRESS));
    mail.setLogin(AppProperties.getProperty(MailKeys.PROP_KEY_SENDER_MAIL_ADDRESS));
    mail.setPassword(AppProperties.getProperty(MailKeys.PROP_KEY_SENDER_MAIL_PW));
    mail.setPop3Host(AppProperties.getProperty(MailKeys.PROP_KEY_SENDER_POP3_SERVER));
    int smptPort = Integer.parseInt(AppProperties.getProperty(MailKeys.PROP_KEY_SENDER_SMTP_PORT));
    mail.setSmtp(AppProperties.getProperty(MailKeys.PROP_KEY_SENDER_SMTP_SERVER), smptPort);
    String docID = metadata.getProperty(Metadata.DOCUMENT_ID);
    mail.setSubject("::from::OCR:: " + docID);
    if (Boolean.parseBoolean(AppProperties.getProperty(MailKeys.PROP_KEY_SET_FULLTEXT_INTO_MAIL_BODY))) {
      String fulltext = metadata.getProperty(Metadata.FULLTEXT);
      String htmltext = HtmlFormatter.getHtmlString(fulltext, false, false);
      mail.setText("<p>" + htmltext + "</p>");
    }
    try {
      mail.sendMail();
      return true;
    }
    catch (MessagingException e) {
      LogUtils.log(e);
      return false;
View Full Code Here

        }
      }

      private void sendZipFile(File zipFile) {
        try {
          SendHtmlMailUtils mail = new SendHtmlMailUtils();
          mail.addAttachment(zipFile);
          mail.addTO(AppProperties.getProperty(MailKeys.PROP_KEY_RECEIVER_MAIL_ADDRESS));
          mail.setFrom(AppProperties.getProperty(MailKeys.PROP_KEY_SENDER_MAIL_ADDRESS));
          mail.setLogin(AppProperties.getProperty(MailKeys.PROP_KEY_SENDER_MAIL_ADDRESS));
          mail.setPassword(AppProperties.getProperty(MailKeys.PROP_KEY_SENDER_MAIL_PW));
          mail.setPop3Host(AppProperties.getProperty(MailKeys.PROP_KEY_SENDER_POP3_SERVER));
          int smptPort = Integer.parseInt(AppProperties.getProperty(MailKeys.PROP_KEY_SENDER_SMTP_PORT));
          mail.setSmtp(AppProperties.getProperty(MailKeys.PROP_KEY_SENDER_SMTP_SERVER), smptPort);
          mail.setSubject("Your zipped documents");
          mail.setText("");
          mail.sendMail();
        }
        catch (Exception e) {
          LogUtils.log(e);
          SwingUtils.showError(God.appWindow.frame, "Problems when sending documents mail! [" + e.getMessage() + "]");
        }
View Full Code Here

TOP

Related Classes of de.chris_soft.utilities.SendHtmlMailUtils

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.