简体   繁体   English

如何在IBM Lotus Notes插件中捕获“发送邮件”

[英]How to capture “send mail” in plugin for IBM Lotus notes

Here is what I am trying to do: Add a special button to attach files to Notes "New message" window. 这是我要执行的操作:添加一个特殊按钮,将文件附加到Notes“新消息”窗口。 If files were attached using this button, when email sent, they should be uploaded to the server and link to them added to the email. 如果使用此按钮附加了文件,则在发送电子邮件时,应将其上传到服务器,并将链接添加到电子邮件中。

My question - is it possible (and how) to capture "send mail" event in the plugin for Lotus Notus? 我的问题-是否有可能(以及如何)在Lotus Notus的插件中捕获“发送邮件”事件?

I don't know how an Eclipse plugin would do this. 我不知道Eclipse插件如何做到这一点。 Furthermore, since Notes can be used off-line -- when it would be impossible to upload files to a server -- it would be better to have code running on the Domino server intercept the mail messages and perform the upload. 此外,由于Notes可以脱机使用-当不可能将文件上传到服务器时-最好在Domino服务器上运行代码来拦截邮件并执行上传。

Most products that hook mail operations on the server use the Lotus Notes C API's Extension Manager functions to hook the EM_BEFORE notification for the EM_NSFNOTEUPDATE event and check whether the NSFNoteUpdate operation occurred within the server's mail.box files, and then check whether the the message requires special processing (ie, in your case that would be by looking for a special NotesItem that your button code has inserted into the message). 大多数在服务器上挂接邮件操作的产品都使用Lotus Notes C API的扩展管理器功能来挂接EM_NSFNOTEUPDATE事件的EM_BEFORE通知,并检查NSFNoteUpdate操作是否在服务器的mail.box文件中发生,然后检查消息是否要求特殊处理(例如,在您的情况下,将通过查找按钮代码已插入消息中的特殊NotesItem)。 The usual coding method for this is to immediately change the status of the message to put it on hold, preventing the Domino router from attempting to send the message while your code is still working on it. 通常的编码方法是立即更改消息的状态以使其处于保留状态,以防止Domino路由器在代码仍在处理时尝试发送该消息。 Many products actually have two components - the EM hook DLL and a separate server task that receives a signal from the hook DLL, processes the message, and then releases it from on hold status. 实际上,许多产品都有两个组件-EM挂钩DLL和一个单独的服务器任务,该任务从挂钩DLL接收信号,处理该消息,然后将其从保持状态释放。 This approach keeps your code from tying up router threads while processing large files. 这种方法可以防止您的代码在处理大型文件时占用路由器线程。

(Note: Newer versions of the Domino server have the ability to use OSGI plugins written in Java instead of using the Notes C API for operations like this. I've not looked into the details of how this might work for operations that process mail messages. ) (注意:较新版本的Domino服务器具有使用Java编写的OSGI插件的能力,而不是使用Notes C API进行这样的操作。我没有研究如何处理处理邮件消息的细节。 )

I sort of figured it out. 我有点想通了。 There is a very nice extension point provided in 8.5 - "com.ibm.notes.mailsend.MailSendAttachmentsDialog", that is specifically exists for custom handling of attachments. 8.5中提供了一个非常好的扩展点-“ com.ibm.notes.mailsend.MailSendAttachmentsDialog”,专门用于自定义处理附件。 You can see it in plugin.xml, in IBM\\Lotus\\Notes\\framework\\shared\\eclipse\\plugins\\com.ibm.notes.mailsend_8.5. 您可以在plugin.xml中的IBM \\ Lotus \\ Notes \\ framework \\ shared \\ eclipse \\ plugins \\ com.ibm.notes.mailsend_8.5中看到它。 * .jar. * .jar。

The only problem is - it handles just attachments and does not have access to anything else. 唯一的问题是-它仅处理附件,无法访问其他任何内容。 So if somebody figured how to get subject line and the message text from there, please reply. 因此,如果有人想出了如何从中获取主题行和消息文本,请回复。

Update: got it. 更新:知道了。

NotesUIElement elem = (new NotesUIWorkspace()).getCurrentElement();
if (elem instanceof NotesUIDocument) {
NotesUIDocument doc = ((NotesUIDocument) elem);
String to = doc.getField("EnterSendTo").getText();
String cc = doc.getField("EnterCopyTo").getText();
String bcc = doc.getField("EnterBlindCopyTo").getText();
String subject = doc.getField("Subject").getText();
String body = doc.getField("Body").getText();
    ....
 }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM