我通过编写 java 邮件发件人程序通过 Domino Server 发送电子邮件。以前我使用的是notes dll,但现在我切换到了iiop。从那以后,我无法看到我发送的加密邮件的内容。收件人可以很好地阅读邮件,只有我。但我应该能够看到我发送的加密邮件。
当我通过 Lotus Notes 客户端发送电子邮件时,它可以工作。我是否忘记在代码中设置任何内容或什么?
使用的代码如下:
public boolean sendMail(boolean schedule, String subject, String body, List<String> recipients, boolean doEncryt, boolean html, List<Binary> binaries, List<String> cc, List<String> bcc, List<String> replyTo)
{
String errorTxt = "";
boolean diiop = true;
try
{
Session session = null;
// if (diiop)
try {
session = NotesFactory.createSession(NOTESMAILSERVER,"SOMEID",NOTESIDPW);
diiop = true;
}
// else
catch (Exception exc){
NotesThread.sinitThread();
session = NotesFactory.createSession();
Registration lRegistration = session.createRegistration();
lRegistration.switchToID(ResourceHelper.findResource(NOTESIDPATH).getFile().getAbsolutePath(), NOTESIDPW);
diiop = false;
}
DbDirectory dir = session.getDbDirectory(NOTESMAILSERVER);
Database lDb = dir.openMailDatabase();
session.setConvertMime(true);
session.setConvertMIME(true);
Document lDoc = lDb.createDocument();
lDoc.replaceItemValue("Form" ,"Memo");
//set receip email addresses
fillAdressItem(lDoc, recipients, "SendTo");
fillAdressItem(lDoc, cc, "CopyTo");
fillAdressItem(lDoc, bcc, "BlindCopyTo");
//set subject
lDoc.replaceItemValue("Subject" , subject);
//set sender
lDoc.replaceItemValue("From", this.FROM);
lDoc.replaceItemValue("Principal", this.FROM);
//prepare body text
prepareRichTextBody(body, html, session, lDoc);
//handle attachments
RichTextItem lAttachmentItem = lDoc.createRichTextItem("attachments");
if(binaries != null)
{
for(Binary binary : binaries)
{
File tempFile = new File(getTempFolder(),binary.getName());
IOUtils.copyLarge(binary.getDataInputStream(), new FileOutputStream(tempFile));
lAttachmentItem.embedObject(EmbeddedObject.EMBED_ATTACHMENT, "", tempFile.getPath(), tempFile.getName());
tempFile.delete();
}
}
//save if aSaveOnSend is true
lDoc.setSaveMessageOnSend(true);
//encrypt document if requested
if(doEncryt)
{
lDoc.setEncryptOnSend(true);
lDoc.encrypt();
}
//send mail
lDoc.send();
return(true);
}
catch(Throwable lE)
{
}
finally
{
if (!diiop) NotesThread.stermThread();
}
}
请让我知道我错过了什么。
谢谢