Csharp: jmail組件發送郵件
jmail.Message MailObj = new jmail.MessageClass(); MailObj.From = "geovindu@qq.com"; //发件人的地址 可以显示与服务名不一样 MailObj.FromName = "締友計算機信息技術有限公司";//用户名 //MailObj.FromName = "geovindu@dupcit.com"; MailObj.Logging = true; MailObj.MailServerUserName = "geovindu@qq.com"; //发件人地址 MailObj.ReplyTo = "geovindu@163.com"; //回复邮件名称 MailObj.MailServerPassWord = "123456789"; //服务器验证 //MailObj.Text = "text/html"; MailObj.HTMLBody = "涂斯博,涂聚文,<br/>涂聚文"+DateTime.Now.ToString();//內容 MailObj.Charset = "gb2312";//編碼 MailObj.Subject = "缔友计算机信息技术有限公司項目解決方案事宜";//標題 MailObj.AddRecipient("463588883@qq.com", "Geovin Du", "A"); //添加接收人 MailObj.AddRecipientBCC("401620863@qq.com", "b"); //密抄 MailObj.AddRecipientCC("413265257@qq.com", "涂年生", "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();
哲学管理(学)人生, 文学艺术生活, 自动(计算机学)物理(学)工作, 生物(学)化学逆境, 历史(学)测绘(学)时间, 经济(学)数学金钱(理财), 心理(学)医学情绪, 诗词美容情感, 美学建筑(学)家园, 解构建构(分析)整合学习, 智商情商(IQ、EQ)运筹(学)生存.---Geovin Du(涂聚文)