例: createMIMEEntity method

次のエージェントは MIME 形式のメールメッセージを作成します。

import lotus.domino.*;

public class JavaAgent extends AgentBase {

  public void NotesMain() {

    try {
      Session session = getSession();
      AgentContext agentContext = session.getAgentContext();

      // (Your code goes here)
      Stream stream = session.createStream();
      session.setConvertMIME(false); // Do not convert MIME to RT
      Database db = agentContext.getCurrentDatabase();
      Document doc = db.createDocument();
      doc.replaceItemValue("Form", "Memo");
      MIMEEntity body = doc.createMIMEEntity();
      header = body.createHeader("Subject");
      header.setHeaderVal("MIME message");
      header = body.createHeader("To");
      header.setHeaderVal("Roberta Person");
      stream.writeText("Text of message.");
      body.setContentFromText(stream, "text/plain;charset=UTF-8",
        MIMEEntity.ENC_NONE);
      doc.send(false);
      session.setConvertMIME(true); // Restore conversion
    
    } catch(Exception e) {
      e.printStackTrace();
    }
  }
}