首页 文章

在 Lotus Notes 中自动执行邮件

提问于
浏览
0

我们需要从 JSP 页面打开 Lotus Notes 客户端。

当前在 JSP 中,我们正在使用ActiveXObject(Outlook.Application)打开 Microsoft Outlook Client。

从电子邮件到电子邮件,电子邮件主题和电子邮件正文应在“请求范围”中填充。我有一个解决方案,但是由于只能直接发送邮件,因此我需要打开 Lotus Notes 页面。有一些方法,例如sendtoformcreate。输入所有详细信息后单击“提交”按钮,是否有任何方法可以打开“撰写邮件”选项?不仅是 JavaScript。如果解决方案是在 Java 中也没有问题。

基本上,用户只需单击页面上的某些链接,然后 Lotus Notes 客户端应打开 pre-populated 信息。最后,用户将查看电子邮件的内容,将需要添加的任何消息添加到电子邮件正文中,然后最终发送电子邮件。如果可能的话,也将代码发送给我。

2 回答

  • 2

    根据您的这里帖子,您似乎想使用 front-end/UI 功能时正在使用 back-end 类。

    我同意这个帖子-,如果可能的话,您应该使用mailto:链接来实现此功能。如果 Lotus Notes 是其默认的 e-mail 程序,则 mailto:链接将启动 Notes 客户端,编写备忘录,并使用您指定的内容填充所需的字段。

    如果 mailto:不能满足您的需求,则可以尝试使用“ Lotus Notes 自动化类”中的 front-end 类。这是 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>
    
  • 2

    它应该大致像这样工作。自实施此功能以来已经有一段时间了。如果我没记错的话,您应该:

    Document doc = db.createDocument("Memo");
    doc.setItemValue("Subject", "My Subject");
    doc.setItemValue("SendTo", "MyEmailAddresses");
    
    RichTextItem rti = doc.getFirstItem("Body");
    rti.addText("MyMailContent");
    
    doc.save();
    
    • 使用doc.getUrl()获取之前创建的文档的 URL,并将该 URL 作为链接显示在 JSP 上。

相关问题