public abstract class Domino {
private final String host="dminoHost";
private final String user="steeven";
private final String pwd="password";
private final String IOR = "IOR:010000002900000049444c3a6c6f7475732f646f6d696e6f2f636f7262612f494f626a6563745365727665723a312e3000000000010000000000000054000000010101000e0000003133332e3232312e3138382e3100acf6310000000438353235363531612d656336382d313036632d656565302d303037653264323233336235004c6f7475734e4f4901000100000000000000";
protected lotus.domino.Session s;
public Domino() throws NotesException{
createSession();
System.out.println("domino:" s.toString());
}
private void createSession() throws NotesException{
// s = NotesFactory.createSession(host,user,pwd);
// s = NotesFactory.createSessionWithIOR(IOR,user,pwd);
s = NotesFactory.createSessionWithIOR(IOR);
}
}
===================================================================================
File: Sendmail.java:
===================================================================================
package steeven.lotus;
import lotus.domino.*;
import java.util.*;
//import lotus.notes.*;
public class Sendmail extends Domino{
java.util.ArrayList grpUsers = new java.util.ArrayList();
Database db;
Document memo;
RichTextItem rti;
private Vector to = new Vector();
private boolean attachForm = false;
static String mailFooter = "\n\n\n此邮件由WebMail发送 http://www/mail.jsp\n\n";
public Sendmail() throws NotesException{
System.out.println("sendmail");
db = s.getDatabase(null,"WebMail.nsf");
memo = db.createDocument();
rti = memo.createRichTextItem("Body");
memo.setEncryptOnSend(true);
memo.setSignOnSend(true);
memo.sign();
memo.setSaveMessageOnSend(true);
}
public Sendmail(String to,String from,String subject,String body) throws NotesException{
this();
setSendTo(to);
setFrom(from);
setSubject(subject);
setBody(body);
System.out.println("Sendmail with contructor");
}
public Sendmail(String to[],String from,String subject,String body) throws NotesException{
this();
setSendTo(to);
setFrom(from);
setSubject(subject);
setBody(body);
System.out.println("Sendmail with contructor");
}
public void setSubject(String n) throws NotesException{
memo.appendItemValue("Subject",n);
}
public void setFrom(String n) throws NotesException{
memo.appendItemValue("Principal",n);
}
public void setSendTo(String n) throws NotesException{
to.add(n);
memo.appendItemValue("SendTo",n);
}
public void setSendTo(String n[]) throws NotesException{
appendArray("SendTo",n);
for(int i=0;i