Examples: setHeaderValAndParams method
This example creates a multi-part MIME entity, setting header and parameter values as necessary. It uses an X-Notes-Item header to generate the Form item.
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();
// Do not convert MIME to rich text
session.setConvertMIME(false);
Database db = agentContext.getCurrentDatabase();
Document doc = db.createDocument();
// Create parent entity
MIMEEntity body = doc.createMIMEEntity();
MIMEHeader header = body.createHeader("Content-Type");
header.setHeaderVal("multipart/mixed");
header = body.createHeader("X-Notes-Item");
header.setHeaderValAndParams("Memo; name=Form");
header = body.createHeader("Subject");
header.setHeaderVal("MIME message");
header = body.createHeader("To");
header.setHeaderVal("Roberta Person");
// Create first child entity
MIMEEntity child = body.createChildEntity();
stream.writeText("Text of message for child 1.\n");
child.setContentFromText(stream, "text/plain", MIMEEntity.ENC_NONE);
stream.truncate();
// Create second child entity
child = body.createChildEntity();
stream.writeText("Text of message for child 2.");
child.setContentFromText(stream, "text/plain", MIMEEntity.ENC_NONE);
doc.send(false);
// Restore conversion
session.setConvertMIME(true);
} catch(Exception e) {
e.printStackTrace();
}
}
}