Csharp: jmail組件發送郵件

jmail.Message MailObj = new jmail.MessageClass();
           MailObj.From = "[email protected]";  //发件人的地址 可以显示与服务名不一样
           MailObj.FromName = "締友計算機信息技術有限公司";//用户名
           //MailObj.FromName = "[email protected]"; 
           MailObj.Logging = true;
           MailObj.MailServerUserName = "[email protected]";   //发件人地址
           MailObj.ReplyTo = "[email protected]"; //回复邮件名称
           MailObj.MailServerPassWord = "123456789"; //服务器验证
           //MailObj.Text = "text/html";
           MailObj.HTMLBody = "涂斯博,涂聚文,
涂聚文"+DateTime.Now.ToString();//內容            MailObj.Charset = "gb2312";//編碼            MailObj.Subject = "缔友计算机信息技术有限公司項目解決方案事宜";//標題                      MailObj.AddRecipient("[email protected]", "Geovin Du", "A");  //添加接收人            MailObj.AddRecipientBCC("[email protected]", "b");  //密抄            MailObj.AddRecipientCC("[email protected]", "涂年生", "c");//抄送            MailObj.Priority = 1;//邮件的紧急程序,1 为最快,5 为最慢, 3 为默认值            MailObj.AddAttachment(@"C:\\DSCF0066.jpg", false, "image/jpg");            MailObj.AddAttachment(@"C:\\EmployeesInfo.xls", false, "application/excel");            MailObj.AddAttachment(@"C:\\geovindu.doc", false, "application/msword");//大附件发送 23.77M            Thread.Sleep(1000);              try            {                bool bool_OK = MailObj.Send("mail.jw28.com", false);                if (bool_OK == true)                {                    MessageBox.Show("邮件发送成功!");                    //this.label3.Text = "邮件发送成功!"; //不可以在线程中用                }                if (bool_OK == false)                {                    MessageBox.Show("邮件发送失败!");                }            }            catch (Exception ex)            {                MessageBox.Show(ex.Message);            }              MailObj.Close();

你可能感兴趣的:(.NET)