有现成源码的吗?

解决方案 »

  1.   

    你要的是启动outlook的程序,还是只是需要他的邮件发送功能?如果只是需要邮件发送功能,为什么要去调用outlook?outlook也是借助第三方来发送和接收邮件的
      

  2.   

    最简单发送邮件的方法是使用SmtpClient.
    参考
    使用Gmail发送邮件
    http://www.cnblogs.com/skywind/archive/2007/09/21/901734.html
      

  3.   

    使用outlook也可以,要使用Microsoft.Office.Interop.Outlook,也即是outlook的com组件
    下面的内容转自:http://tech.ddvip.com/2009-04/1238580481113103.html
    下面是步骤:1,添加引用Microsoft.Office.Interop.Outlook;  这个必须在Reference上面点右键,选添加才行,直接using会说找不到。  2,代码如下:            Microsoft.Office.Interop.Outlook.Application outlookObj = new Microsoft.Office.Interop.Outlook.Application();
                MailItem Item = (Microsoft.Office.Interop.Outlook.MailItem)
          outlookObj.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem);
                Item.To = "[email protected]";            Item.Subject = "hello";            Item.Body = "hello";            Item.Send();  但是,恼人的是,用这个方法发送的话,Outlook会产生一个对话框,提醒用户有未知的应用程序正在冒充她的名义发送邮件。  大家可以去试试。如果找到回避这个警告框的方法,请告诉我,谢谢!
      

  4.   

    如果你有自己的smtp服务器的话,建议使用smtpclient.
    不过你们使用outlook应该有自己的exchange服务器。exchange服务器支持smtp的。
      

  5.   


    using System;
    using System.Collections.Generic;
    using System.Text;
    using System.Collections;
    using System.Net;
    using System.Net.Mail;namespace SendMail
    {
        public class MailSend
        {
            public static void SendMail(string fromMail,List<string> toMails,List<string> CCMails,string subject,string context,List<string> filenames)
            {
                System.Net.Mail.SmtpClient smtp = new SmtpClient("你使用的SMTP主机");
                System.Net.Mail.MailMessage mail = new MailMessage();
                mail.From = new MailAddress(fromMail);
                foreach (string toMail in toMails) 
                {
                    mail.To.Add(new MailAddress(toMail));
                }            foreach (string ccmail in CCMails) 
                {
                    mail.CC.Add(new MailAddress(ccmail));
                }            foreach (string filename in filenames) 
                {
                    mail.Attachments.Add(new Attachment(filename));
                }            mail.Subject = subject;
                mail.Body = context;
                smtp.UseDefaultCredentials=false;
                smtp.DeliveryMethod=SmtpDeliveryMethod.Network;
                smtp.Send(mail);
            }
        }
    }