protected void uiLinkButtonSubmit_Click(object sender, EventArgs e) { try { MailMessage msg = new MailMessage(); string mail = ConfigurationManager.AppSettings["mail"]; string mailto = ""; YMC.BLL.NewsLetter objData = new YMC.BLL.NewsLetter(); objData.LoadAll(); for (int i = 0; i < objData.RowCount - 1; i++) { mailto += objData.Email + ";"; objData.MoveNext(); } msg.To.Add(mailto); msg.From = new MailAddress(mail); msg.Subject = uiTextBoxTitle.Text; msg.IsBodyHtml = true; msg.BodyEncoding = Encoding.UTF8; msg.Body = uiFCKeditorPage.Value; SmtpClient client = new SmtpClient(ConfigurationManager.AppSettings["mailserver"], 25); //SmtpClient client = new SmtpClient("smtp.gmail.com", 587); //client.EnableSsl = true; client.UseDefaultCredentials = false; //client.EnableSsl = true; client.Credentials = new System.Net.NetworkCredential(mail, ConfigurationManager.AppSettings["mailpass"]); //client.Credentials = new System.Net.NetworkCredential("*****@*****.**", "0103566600"); client.Send(msg); uiLabelSuccess.Visible = true; } catch (Exception ex) { uiLabelError.Visible = true; } }
private void BindData() { YMC.BLL.NewsLetter objData = new YMC.BLL.NewsLetter(); objData.LoadAll(); uiGridViewUsers.DataSource = objData.DefaultView; uiGridViewUsers.DataBind(); }