本文介绍了Lotus Notes Java API.邮件转发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将电子邮件从我的Lotus Notes收件箱转发到我的gmail帐户.

I would like to forward emails from my Lotus Notes inbox to my gmail account.

Lotus Notes规则和代理在我们的服务器上被禁用,因此我为此开发了外部应用程序.我正在使用document.send方法,并且邮件成功到达了我的Gmail邮箱.唯一的问题是,电子邮件经常也在我的Lotus Notes收件箱中重复.我只是发现原因是我没有清除"CC"和"BCC"字段,但是,我正在寻找一种按原样转发电子邮件的方式-这意味着保留原始的CC和BCC和TO字段-与转发代理完全相同.

Lotus Notes rules and agents are disabled on our server, so I developed external application for that.I am using document.send method and mail successfully arrives to my gmail box.The only problem is that often the email also duplicated in my Lotus Notes inbox.I just found that the reason of that is "CC" and "BCC" fields, which I don't clean up,however, I am looking for the way to forward email as it is - which means keep original CC and BCC and TO fields - exactly on the same way as it is done by forwarding agent.

我正在Windows 7 64位上使用"IBM Notes 9".

I am using "IBM Notes 9" on Windows 7 64 bit.

我已经准备了一个代码样本来演示我在做什么.

I've prepared a code sample that demonstrates what I am doing.

package com.example;

import lotus.domino.*;

public class TestMailForwarder {
    public static void main(String[] args) throws NotesException {
        NotesThread.sinitThread();
        try {
            Session notesSession = NotesFactory.createSession(
                    (String) null, (String) null, Consts.NOTES_PASSWORD);
            DbDirectory dir = notesSession.getDbDirectory(Consts.NOTES_SERVER);
            Database mailDb = dir.openDatabaseByReplicaID(Consts.MAILDB_REPLICA_ID);
            forwardAllEmails(mailDb);
        } finally {
            NotesThread.stermThread();
        }
    }

    private static void forwardAllEmails(Database mailDb) throws NotesException {
        View inbox = mailDb.getView("$Inbox");
        //noinspection LoopStatementThatDoesntLoop
        for (Document document = inbox.getFirstDocument();
                 null != document;
                 document = inbox.getNextDocument(document)) {
            document.send(Consts.GMAIL_ADDRESS);
            break;
        }
    }
}

推荐答案

最后,我找到了一个可用的解决方案: AWESYNC.MAIL .它是一种商业软件,但确实可以满足我的需求.

Finally, I've found a ready solution: AWESYNC.MAIL.It is a commercial software but it does exactly what I need.

这篇关于Lotus Notes Java API.邮件转发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 21:53