我试图在我的代码中解决一点问题。我通过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);
答案 0 :(得分:0)
您正在创建数据库对象:
NotesDatabase nd = notesSession.GetDatabase("","names.nsf", bCreateonfail: false);
然后,您将在该数据库对象中创建一个文档对象:
NotesDocument notesDocument = nd.CreateDocument();
然后您将文档对象保存在该数据库对象中:
notesDocument.Save(true, false);
你看到了问题吗?
您将文档保存在运行代码的本地计算机上的names.nsf中。如果你在names.nsf中查看选择@All的视图,你会在那里找到它。