// 根据专业发送邮件 protected void BtnInformSpec_Click(object sender, EventArgs e) { if (ddlSpeciality.SelectedValue != "null") { // 发送邮件 EmailSender email = new EmailSender(); List <TuitionMS.DAL.Students> students = finSrv.GetSpecStudent(ddlSpeciality.SelectedValue); foreach (TuitionMS.DAL.Students s in students) { if (s.studEmail != "") { // 设置邮箱 email.SetEmailSender(s.studEmail); // 发送邮件 email.Send(subject, s.studName + content); } } lbMessage.Text = "通知成功!"; } else { lbMessage.Text = "请选择学院和专业"; } }