zoukankan      html  css  js  c++  java
  • C# 调用Lotus Notes发送邮件

    As title.

     1 using System;
     2 using System.Collections.Generic;
     3 using System.ComponentModel;
     4 using System.Data;
     5 using System.Drawing;
     6 using System.Linq;
     7 using System.Text;
     8 using System.Windows.Forms;
     9 using Domino;
    10 
    11 namespace NetUseNotes
    12 {
    13     public partial class Form1 : Form
    14     {
    15         NotesSession NSession;
    16         NotesDatabase NDataBase;
    17         
    18         public Form1()
    19         {
    20             InitializeComponent();
    21         }
    22         private void btnsend_Click(object sender, EventArgs e)
    23         {
    24             try
    25             {
    26                 if (NSession != null)
    27                 {
    28                     NotesDocument NDocument = NDataBase.CreateDocument();
    29                     NDocument.ReplaceItemValue("Form", "Memo");
    30                     
    31                     NDocument.ReplaceItemValue("SendTo", txtToUser.Text);                   
    32                     NDocument.ReplaceItemValue("Subject", txtSubject.Text);                     
    33                     NotesRichTextItem rt = NDocument.CreateRichTextItem("Body");
    34                     rt.AppendText(txtBody.Text);                    
    35                  
    36                     object obj = NDocument.GetItemValue("SendTo");
    37                     NDocument.Send(false, ref obj);
    38                     NDocument = null;
    39                     MessageBox.Show("Successfully!");
    40                 }
    41             }
    42             catch (Exception ex)
    43             {
    44                 MessageBox.Show("Error:" + ex.Message);
    45             }
    46         } 
    47 
    48         private void Form1_Load(object sender, EventArgs e)
    49         {            
    50             NSession = new NotesSession();
    51             NSession.Initialize("UserName");            
    52             NDataBase = NSession.GetDatabase("Notes Server", "names.nsf", false); 
    53         }         
    54     }
    55 }
查看全文
  • 相关阅读:
    【正视CSS 03】block与position,出门在外的朋友端午节快乐
    【正视CSS 07】再看verticalalign
    【正视CSS 06】构建我们自己的世界观!
    【正视CSS 02】inline与lineheight、float、absolute的故事
    【初窥javascript奥秘之闭包】叶大侠病都好了,求不踩了:)
    【javascript面向对象之路】让我们一起来坦克大战吧01
    Python学习之三:《Dive in Python》学习笔记二
    恢复GMail选择栏(All None Read Unread….)的油猴(GreaseMonkey)脚本
    群聊天时学习到的两个JS知识(变量范围,Foreach顺序)
    利用宏自动附加到WebServer进程
  • 原文地址:https://www.cnblogs.com/allen0118/p/2556038.html
  • Copyright © 2011-2022 走看看