Package org.openntf.domino

Examples of org.openntf.domino.MIMEHeader


    }

    if (itemType == Type.MIME_PART) {
      MIMEEntity entity = getMIMEEntity();
      if (entity != null) {
        MIMEHeader contentType = entity.getNthHeader("Content-Type");
        String headerval = contentType.getHeaderVal();
        if ("application/x-java-serialized-object".equals(headerval) || "application/x-java-externalized-object".equals(headerval)) {
          itemType = Type.MIME_BEAN;
        }
        getParent().closeMIMEEntities(false, getName());
      }
View Full Code Here


            is = new ByteArrayInputStream(attach.getBytes());
          }

          if (null != is) {
            MIMEEntity mimeChild = parent.createChildEntity();
            MIMEHeader mimeHeader = mimeChild.createHeader("Content-Disposition");

            if (attach.isInlineImage()) {
              mimeHeader.setHeaderVal("inline; filename=\"" + attach.getFileName() + "\"");
            } else {
              mimeHeader.setHeaderVal("attachment; filename=\"" + attach.getFileName() + "\"");
            }

            mimeHeader = mimeChild.createHeader("Content-ID");
            mimeHeader.setHeaderVal("<" + attach.getContentId() + ">");

            streamFile = getSession().createStream();
            streamFile.setContents(is);
            mimeChild.setContentFromBytes(streamFile, contentType, MIMEEntity.ENC_IDENTITY_BINARY);
            streamFile.close();
View Full Code Here

  @Override
  public Document send() {
    try {
      Stream stream;
      MIMEEntity mimeEntity;
      MIMEHeader mimeHeader;
      Database currDb;

      Session currSess = getSession();
      currSess.setConvertMime(false); // in case Khan is still in suspended animation!

      // Create memo doc
      try {
        currDb = currSess.getCurrentDatabase();
        if (null == currDb) {
          // Will this work if we're running from DOTS or OSGi plugin??
          currDb = currSess.getDatabase(currSess.getServerName(), "mail.box");
        }
      } catch (Throwable t) {
        currDb = currSess.getDatabase(currSess.getServerName(), "mail.box");
      }
      Document memo = currDb.createDocument();
      memo.put("RecNoOutOfOffice", "1");    //no replies from out of office agents
      MIMEEntity mimeRoot = memo.createMIMEEntity("Body");

      mimeHeader = mimeRoot.createHeader("To");
      mimeHeader.setHeaderVal(join(getTo(), ""));
      memo.replaceItemValue("sendTo", getTo());

      if (cc_.size() > 0) {
        mimeHeader = mimeRoot.createHeader("CC");
        mimeHeader.setHeaderVal(join(getCC(), ""));
        memo.replaceItemValue("cc", getCC());
      }

      if (bcc_.size() > 0) {
        mimeHeader = mimeRoot.createHeader("BCC");
        mimeHeader.setHeaderVal(join(getBCC(), ""));
        memo.replaceItemValue("bcc", getBCC());
      }

      //set subject
      mimeHeader = mimeRoot.createHeader("Subject");
      mimeHeader.setHeaderVal(getSubject());

      //create text/alternative directive: text/plain and text/html part will be childs of this entity
      MIMEEntity mimeRootChild = mimeRoot.createChildEntity();
      String mimeBoundary = memo.getUniversalID().toLowerCase();
      mimeHeader = mimeRootChild.createHeader("Content-Type");
      mimeHeader.setHeaderVal("multipart/alternative; boundary=\"" + mimeBoundary + "\"");

      //create plain text part
      if (getText().size() > 0) {
        mimeEntity = mimeRootChild.createChildEntity();
        stream = currSess.createStream();
View Full Code Here

    if (StringUtil.isEmpty(getSenderEmail())) {
      return;
    }

    MIMEHeader mimeHeader = null;

    mimeHeader = mimeRoot.createHeader("Reply-To");
    mimeHeader.setHeaderVal(getSenderEmail());

    mimeHeader = mimeRoot.createHeader("Return-Path");
    mimeHeader.setHeaderVal(getSenderEmail());

    if (StringUtil.isEmpty(getSenderName())) {

      mimeHeader = mimeRoot.createHeader("From");
      mimeHeader.setHeaderVal(getSenderEmail());
      mimeHeader = mimeRoot.createHeader("Sender");
      mimeHeader.setHeaderVal(getSenderEmail());

    } else {

      mimeHeader = mimeRoot.createHeader("From");
      mimeHeader.addValText("\"" + getSenderName() + "\" <" + getSenderEmail() + ">", "UTF-8");
      mimeHeader = mimeRoot.createHeader("Sender");
      mimeHeader.addValText("\"" + getSenderName() + "\" <" + getSenderEmail() + ">", "UTF-8");

    }

  };
View Full Code Here

TOP

Related Classes of org.openntf.domino.MIMEHeader

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.