C#发送邮件功能
程序代码:
namespace 练习5 { public partial class Form1 : Form { private int cishu = 0; public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { string name = textBox1.Text; string pass = textBox2.Text; //admin不区分大小写! name.Equals("admin",StringComparison.OrdinalIgnoreCase) if (name.Equals("admin", StringComparison.OrdinalIgnoreCase) && pass == "8888") { MessageBox.Show("恭喜你,登录成功"); } else { cishu++;//cishu要做成private int cishu; 局部变量是没有用的! if (cishu > 3) { MessageBox.Show("错误次数过多,程序结束"); Application.Exit();//关闭程序代码 用this.close();也可以 } MessageBox.Show("你输入的信息不正确,登录失败."); } } private void button2_Click(object sender, EventArgs e) { this.Close(); } private void textBox1_TextChanged(object sender, EventArgs e) { } } }怎么能把name 和pass信息用邮件发送到邮箱里去呢???