C#发送带附件的邮件

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

MailMessage m = new MailMessage();
m.From = new MailAddress("ir@sharejs.com", "Raja Item");
m.To.Add(new MailAddress("su@sharejs.com", "Sekaran Uma"));
m.Subject = "File attachment!";
m.Body = "See the attached file.";
m.Attachments.Add(new Attachment(@"C:\test.txt"));
// Send the message
SmtpClient client = new SmtpClient("smtp.w3mentor.com");
client.Send(m);