hmzone 发表于 2015-9-14 08:34:05

利用outlook发邮件

Code
using System;
using Microsoft.Office.Interop.Outlook;
namespace GMService {
    class Program {
      static void Main() {
            Application app = new Application();
            NameSpace ns = app.GetNamespace("mapi");
            ns.Logon("jim", "password", false, true);
            MailItem message = (MailItem) app.CreateItem(OlItemType.olMailItem);
            message.To = "some_man@hotmail.com";
            message.Subject = "A simple test message";
            message.Body = "This is a test. It should work";
            message.Send();
            ns.Logoff();
            Console.Read();
      }
    }
}
页: [1]
查看完整版本: 利用outlook发邮件