1try
2 {
3
4 MailMessage m_message = new MailMessage();
5 m_message.From = new MailAddress("fuchifeng45@yahoo.com.cn");
6 m_message.To.Add(new MailAddress("fuchifeng45@yahoo.com.cn"));
7 m_message.Subject = "使用.NET 2.0发送邮件sample";
8 m_message.Body = "非常简单 ";
9 SmtpClient m_smtpClient = new SmtpClient();
10 m_smtpClient.Send(m_message);
11 Console.WriteLine("发送成功!");
12 }
13 catch (Exception e)
14 {
15 Console.WriteLine(e.Message);
16 }
17 Console.ReadLine();
2 {
3
4 MailMessage m_message = new MailMessage();
5 m_message.From = new MailAddress("fuchifeng45@yahoo.com.cn");
6 m_message.To.Add(new MailAddress("fuchifeng45@yahoo.com.cn"));
7 m_message.Subject = "使用.NET 2.0发送邮件sample";
8 m_message.Body = "非常简单 ";
9 SmtpClient m_smtpClient = new SmtpClient();
10 m_smtpClient.Send(m_message);
11 Console.WriteLine("发送成功!");
12 }
13 catch (Exception e)
14 {
15 Console.WriteLine(e.Message);
16 }
17 Console.ReadLine();
web.config或App.config中配置
config代码