VS2005做的winform发邮件的程序,文本内容是可以发送了,但是我想将在word中编辑好的内容+其它内容发送,就不行了.比如,我要给a,b,c,三个人发一个内容相同,但称呼不同的mail,内容是在word中编辑好了的,有表格/文字 等...这样在winform下没有控件可以放这些内容的,怎么办?像outlook/foxmail等,都可以的,它们的内容编辑区是用什么做的?在VS2005下怎么实现?

解决方案 »

  1.   


    可以在你的内容编辑区嵌入Word,用Word来编辑你的邮件
      

  2.   


     MailAddress fromAddr = new MailAddress(mc.UserEmail);
                MailMessage message = new MailMessage();
                message.From = fromAddr;
                message.Subject =mc.EmailSubject;//设置邮件主题 
                message.IsBodyHtml = true;//设置邮件正文为html格式 这是读WEB的不知道对Word是否可以
      

  3.   

    嵌入Word后,我怎么将word内容和称呼加在一起呢,怎么作为发送内容?
      

  4.   

    可以参考
    http://www.codeproject.com/KB/miscctrl/winwordcontrol.aspx
      

  5.   

    也可以这样在   Visual   C#   .NET   中新建一个   Windows   应用程序项目。默认情况下会创建   Form1。     
      在工具菜单上,单击自定义工具箱以打开自定义工具箱对话框。在   COM   组件选项卡上,添加一个对   Microsoft   WebBrowser   的引用。单击确定,将   WebBrowser   控件添加到   Windows   窗体工具箱。WebBrowser   控件会显示出来,并且在工具箱中带有   Explorer(资源管理器)字样。     
      使用该工具箱向   Form1   添加一个   WebBrowser   控件、一个   OpenFileDialog   控件和一个   CommandButton   按钮。这就会向   Form1   类添加   AxWebBrowser1、OpenFileDialog1   和   Button1   成员变量。     
      在   Form1   上,双击   button1。这就会向   Form1   添加   Button1_Click   事件。     
      在   Form1   的代码窗口中,向列表添加以下命名空间:using   System.Reflection;   
        
      如下所示在   Form1   类中定义一个私有成员:private   Object   oDocument;     
      在   Form1   类的   InitializeComponent   方法的末尾,添加以下代码以处理   Form1_Load、Form1_Closed   和   axWebBrowser1_NavigateComplete2   事件:this.axWebBrowser1.NavigateComplete2   +=   new   AxSHDocVw.DWebBrowserEvents2_NavigateComplete2EventHandler(this.axWebBrowser1_NavigateComplete2);   
      this.Load   +=   new   System.EventHandler(this.Form1_Load);   
      this.Closed   +=   new   System.EventHandler(this.Form1_Closed);   
        
      将下面的代码private   void   button1_Click(object   sender,   System.EventArgs   e)   
      {   
      }   
        
      替换为:   private   void   button1_Click(object   sender,   System.EventArgs   e)   
      {   
        
        String     strFileName;   
        
        //Find   the   Office   document.   
        openFileDialog1.FileName   =   "";   
        openFileDialog1.ShowDialog();   
        strFileName   =   openFileDialog1.FileName;   
                        
        //If   the   user   does   not   cancel,   open   the   document.   
        if(strFileName.Length   !=   0)   
        {   
          Object   refmissing   =   System.Reflection.Missing.Value;   
          oDocument   =   null;   
          axWebBrowser1.Navigate(strFileName,   ref   refmissing   ,   ref   refmissing   ,   ref   refmissing   ,   ref   refmissing);   
        }   
      }   
        
      public   void   Form1_Load(object   sender,   System.EventArgs   e)   
      {   
        button1.Text   =   "Browse";   
        openFileDialog1.Filter   =   "Office   Documents(*.doc,   *.xls,   *.ppt)|*.doc;*.xls;*.ppt"   ;   
        openFileDialog1.FilterIndex   =   1;   
      }   
        
      public   void   Form1_Closed(object   sender,   System.EventArgs   e)   
      {   
        oDocument   =   null;   
      }   
        
      public   void   axWebBrowser1_NavigateComplete2(object   sender,   AxSHDocVw.DWebBrowserEvents2_NavigateComplete2Event   e)   
      {   
        
        //Note:   You   can   use   the   reference   to   the   document   object   to     
        //             automate   the   document   server.   
        
        Object   o   =   e.pDisp;   
              
        oDocument   =   o.GetType().InvokeMember("Document",BindingFlags.GetProperty,null,o,null);   
        
        Object   oApplication   =   o.GetType().InvokeMember("Application",BindingFlags.GetProperty,null,oDocument,null);   
        
        Object   oName   =   o.GetType().InvokeMember("Name",BindingFlags.GetProperty   ,null,oApplication,null);   
        
        MessageBox.Show("File   opened   by:   "   +   oName.ToString()   );     
      }   
        
      按   F5   键运行该项目。单击浏览后,会出现打开对话框,您可以使用该对话框浏览到   Word   文档、Excel   工作表或   PowerPoint   演示文稿。选择任一文件,然后单击打开。文档在   WebBrowser   控件内打开,并出现一个显示有   Office   文档服务器名称的消息框。
      

  6.   

    WebBrowser打开文件后,怎么取WebBrowser中的内容作为邮件内容呢?
      

  7.   

    http://www.codeproject.com/KB/cs/HtmlEditor.aspx
      

  8.   

     这样
    http://www.cnblogs.com/peterzb/archive/2009/07/06/1517399.html
      

  9.   

    用HTML写是可以的.不过怎么弄成像outlook/foxmail那样呢
      

  10.   

    自己写发送代码比较麻烦,可以参考一些现成组件,如Jmail 之类
      

  11.   

    Jmail 可以实现像outlook/foxmail那样
      

  12.   

    outlook/foxmail 中内容编辑那个区域怎么用C#做.我主要是想将Word中的内容复制到这个区域,然后再发送.而word中有表格,
      

  13.   

    发送是可以了,还有一个小问题:以HTML格式了送,收取时,在网页中收是没问题,但用客户端收取时会出现乱码,如中文会变成方框.