Examples: IsSentByAgent property

This agent, which is activated after new mail arrives, sends a reply except to memos sent by programs.

import lotus.domino.*;
import java.util.Vector;
public class JavaAgent extends AgentBase {
  public void NotesMain() {
    try {
      Session session = getSession();
      AgentContext agentContext = session.getAgentContext();
      // (Your code goes here) 
      Database db = agentContext.getCurrentDatabase();
      DocumentCollection dc = 
          agentContext.getUnprocessedDocuments();
      Document reply;
      Vector sendTo;
      Document doc = dc.getFirstDocument();
      while (doc != null) {
        sendTo = doc.getAuthors();
        if (!doc.isSentByAgent()) {
          reply = doc.createReplyMessage(false);
          reply.replaceItemValue
          ("Subject", "Re: " + 
             doc.getItemValueString("Subject"));
          reply.replaceItemValue(
             "Body", "On vacation until 8/15\n");
          reply.send(sendTo);
          }
        doc = dc.getNextDocument(doc);
        }
    } catch(Exception e) {
      e.printStackTrace();
    }
  }
}