.net 使用System.Net.Mail命名空间实现发送邮件功能。 可以添加附件、添加抄送 public static bool SendSystemMail(string host, string sysEmail, string uname, string password, string toEmail, string subject, string content, string[] files, bool isBodyHtml, params string[] ccs) { //创建默认主机的邮件服务器 SmtpClient client = new SmtpClient(host); client.UseDefaultCredentials = false; //设置发送电子邮件方式 client.DeliveryMethod = SmtpDeliveryMethod.Network; //设置身份验证(用户名、密码) client.Credentials = new NetworkCredential(uname, password); //定义返回值 bool isSend = false; try { //获取要发送的电子邮件 MailMessage mail = new MailMessage(sysEmail, toEmail, subject, content); //设置电子邮件编码 mail.BodyEncoding = Encoding.UTF8;