c# 将发送的电子邮件保存在 Lotus Sent 文件夹中(domino 互操作)

c# save sent email in Lotus Sent folder (domino interop)

我正在尝试解决代码中的一个小问题。我正在通过 Domino 服务器发送电子邮件,所有邮件都已成功发送,但在 Lotus Notes 的已发送电子邮件中根本看不到邮件。你能帮助我吗?谢谢

                    NotesSession notesSession = new NotesSession();
                    notesSession.Initialize(passw);
                    NotesDatabase nd = notesSession.GetDatabase("","names.nsf", bCreateonfail: false);

                    if (!nd.IsOpen)
                    {
                        nd.Open();
                    }

                    NotesDocument notesDocument = nd.CreateDocument();

                    notesDocument.SaveMessageOnSend = true;



                    notesDocument.ReplaceItemValue("Form", "Main Topic");

                    // set notes memo fields (To: CC: Bcc: Subject etc) 
                    notesDocument.ReplaceItemValue("SendTo", emailSup);



                    notesDocument.ReplaceItemValue("CopyTo", copyTo);


                    // Subject is the name of pdf file without .pdf
                    notesDocument.ReplaceItemValue("Subject", pdfFiles[i].Remove(pdfFiles[i].Length - 4, 4));

                    // Create the body of the email. This allows you to use the appendtext 
                    NotesRichTextItem richTextItem = notesDocument.CreateRichTextItem("Body");


                    //Path of attachment (pdf file)
                    string AttachPath = @"c:\...\PDF\" + pdfFiles[i];
                    string txtPath = @"c:\...\emailtxt.txt";
                    System.IO.StreamReader txt = new System.IO.StreamReader(txtPath, Encoding.GetEncoding("windows-1250"));

                    // Add email text from txt file.  
                    richTextItem.AppendText(txt.ReadToEnd());

                    // Attach file to e-mail
                    NotesEmbeddedObject obj_notesEmbeddedObject = richTextItem.EmbedObject(EMBED_TYPE.EMBED_ATTACHMENT, "", AttachPath, "Attachment");

                    notesDocument.SaveMessageOnSend = true;
                    notesDocument.Save(true, false);

                    notesDocument.Send(false);

您正在创建数据库对象:

NotesDatabase nd = notesSession.GetDatabase("","names.nsf", bCreateonfail: false);

那么您将在该数据库对象中创建一个文档对象:

 NotesDocument notesDocument = nd.CreateDocument();

然后您将文档对象保存在该数据库对象中:

 notesDocument.Save(true, false);

你看到问题了吗?

您正在 names.nsf 中的文档保存在您的代码为 运行 的本地机器上。如果您查看 names.nsf 中选择了 @All 的视图,您会在那里找到它。