2012-01-10 122 views
0

我们需要从JSP页面打开Lotus Notes客户机。自动化Lotus Notes中的邮件

目前在JSP我们正在开拓利用ActiveXObject(Outlook.Application)

的从邮件,通过电子邮件发送给Microsoft Outlook客户端,邮件主题和邮件正文应该从请求范围填充。我有一个解决方案,但它可能只能直接发送邮件,我需要打开Lotus Notes页面。有一些方法,如sendto,form,create。当我们在输入所有细节后点击提交按钮时,是否有任何方法可以打开撰写邮件选项?不仅JavaScript。如果解决方案在Java中也没有问题。

基本上,用户只需点击页面上的某个链接,然后Lotus Notes客户端应该打开预填充信息。最后,用户将查看电子邮件内容,添加他们需要添加到电子邮件正文中的任何消息,然后发送电子邮件。如果可能的话,请将代码发给我。

+1

如果其中一个答案对您有帮助,请接受它作为答案。 – 2012-01-12 14:46:12

回答

2

它应该像这样工作。自从我实施这个以来已经有一段时间了。如果我没有记错的话,你应该:http://www.ibm.com/developerworks/lotus/library/ls-Java_access_pt1/index.html

  • 撰写形式memo的一个新的文档在目标邮件数据库,并填写必填字段:

    1. 按照本教程中创建的Lotus Notes会话。喜欢的东西:

      Document doc = db.createDocument("Memo"); 
      doc.setItemValue("Subject", "My Subject"); 
      doc.setItemValue("SendTo", "MyEmailAddresses"); 
      
      RichTextItem rti = doc.getFirstItem("Body"); 
      rti.addText("MyMailContent"); 
      
      doc.save();
    2. 得到你与doc.getUrl()之前创建的文档的URL,并出示此URL作为JSP中的链接。

  • 2

    根据您的文章here,它看起来像你正在使用后端类,当你想使用前端/ UI功能。

    我同意this post - 如果可能,您应该使用mailto: link来实现此功能。如果Lotus Notes是他们的默认电子邮件程序,则mailto:链接将启动Notes客户端,撰写备忘录并使用您指定的内容填充所需的字段。

    如果mailto:不能满足您的需求,可以尝试使用“Lotus Notes自动化类”中的前端类。这是来自CodeProject后的示例代码的修改版本:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
    <html xmlns="http://www.w3.org/1999/xhtml"> 
    <head> 
        <title>Lotus</title> 
        <script language="javascript" type="text/javascript"> 
    function SendScriptMail() { 
        var mToMail = document.getElementById('txtMailId').value 
        var mSub = document.getElementById('txtSubject').value 
        var mMsg = document.getElementById('txtContent').value 
        var Session; 
        var Maildb; 
        var UI; 
        var MailDoc; 
        try { 
         // Create the Activex object for NotesSession 
         Session = new ActiveXObject('Notes.NotesSession'); 
         if (Session == null) { 
          throw("NoSession"); 
         } else { 
          // Get mail database 
          Maildb = Session.GetDatabase("", ""); 
          Maildb.OPENMAIL(); 
          if (Maildb == null) { 
           throw("NoMaildb"); 
          } else { 
           // Create the ActiveX object for NotesUIWorkspace 
           UI = new ActiveXObject('Notes.NotesUIWorkspace'); 
           if (UI == null) { 
            throw("NoUI"); 
           } else { 
            MailDoc=UI.Composedocument(Maildb.SERVER, Maildb.FILEPATH, 'Memo'); 
            if (MailDoc == null) { 
             throw('NoMailDoc'); 
            } else { 
             // Populate the fields 
             MailDoc.Fieldsettext('SendTo', mToMail); 
             MailDoc.Fieldsettext('Subject', mSub); 
             // insert message body and place cursor at end of text 
             MailDoc.Gotofield('Body'); 
             MailDoc.Inserttext(mMsg); 
             // destroy the objects 
             Session.Close(); 
             Session = null; 
             UI = null; 
             Maildb = null; 
             MailDoc = null; 
            } 
           } 
          } 
         } 
        } catch (err) { 
         // feel free to improve error handling... 
         alert('Error while sending mail'); 
        } 
    } 
        </script> 
    </head> 
    <body> 
        <table width="100%" height="100%"> 
         <tr> 
          <td width="40%" height="130px"> 
          </td> 
          <td> 
          </td> 
          <td width="40%"> 
          </td> 
         </tr> 
         <tr> 
          <td> 
          </td> 
          <td> 
           <table width="100%"> 
            <tr> 
             <td style="color: Black; font-size: 10px; font-family: Verdana; text-align: left;" 
              width="50px" valign="top"> 
              Mail Id</td> 
             <td> 
              <input id="txtMailId" style="color: #000000; font-size: 10px; font-family: Verdana; 
               height: 11px; text-align: left; top: auto; border: 1px solid #336699; text-decoration: none; 
               width: 176px;" type="text" maxlength="50" /></td> 
            </tr> 
            <tr> 
             <td style="color: Black; font-size: 10px; font-family: Verdana; text-align: left;" 
              valign="top"> 
              Subject</td> 
             <td> 
              <input id="txtSubject" style="color: #000000; font-size: 10px; font-family: Verdana; 
               height: 11px; text-align: left; top: auto; border: 1px solid #336699; text-decoration: none; 
               width: 176px;" type="text" maxlength="50" /></td> 
            </tr> 
            <tr> 
             <td style="color: Black; font-size: 10px; font-family: Verdana; text-align: left; 
              height: 79px;" valign="top"> 
              Content</td> 
             <td> 
              <textarea id="txtContent" cols="20" style="color: #000000; font-size: 10px; font-family: Verdana; 
               height: 75px; text-align: left; top: auto; border: 1px solid #336699; text-decoration: none; 
               width: 176px;"></textarea></td> 
            </tr> 
            <tr> 
             <td> 
             </td> 
             <td> 
              <input id="btnSend" type="button" onclick="SendScriptMail();" style="font-family: Verdana; font-size: 11px; text-align: center; 
               top: auto; width: 60px; background-color: #A55129; border: 1px solid #336699; 
               text-decoration: none; font-weight: normal; color: #FFFFFF;" value="Send" /> 
              <input id="btnCancel" style="font-family: Verdana; font-size: 11px; text-align: center; 
               top: auto; width: 60px; background-color: #A55129; border: 1px solid #336699; 
               text-decoration: none; font-weight: normal; color: #FFFFFF;" type="button" value="Cancel" /></td> 
            </tr> 
           </table> 
          </td> 
          <td> 
          </td> 
         </tr> 
         <tr> 
          <td height="130px"> 
          </td> 
          <td> 
          </td> 
          <td> 
          </td> 
         </tr> 
        </table> 
    </body> 
    </html>