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();
时间: 2024-10-31 16:06:48