protected void LinkButtonSendNotifications_Click(object sender, EventArgs e) { uiPanelSuccess.Visible = false; UsersProfiles up = new UsersProfiles(); Groups gr = new Groups(); List<string> GroupIDs = CheckBoxListGroups.Items.Cast<ListItem>() .Where(li => li.Selected) .Select(li => li.Value) .ToList(); if(GroupIDs.Count>0) up.getuserEmails(GroupIDs); try { MailMessage msg = new MailMessage(); string mail = GetLocalResourceObject("FromMail").ToString(); for (int i = 0; i < up.RowCount; i++) { msg.To.Add(up.Email); up.MoveNext(); } if (!string.IsNullOrEmpty(uiHiddenFieldmails.Value)) msg.To.Add(uiHiddenFieldmails.Value); msg.From = new MailAddress(mail); msg.Subject = GetLocalResourceObject("subject").ToString(); msg.IsBodyHtml = true; msg.BodyEncoding = System.Text.Encoding.UTF8; msg.Body = uiRadEditorContnet.GetHtml(Telerik.Web.UI.EditorStripHtmlOptions.None); SmtpClient client = new SmtpClient(GetLocalResourceObject("Server").ToString(), Convert.ToInt32(GetLocalResourceObject("Port").ToString())); //SmtpClient client = new SmtpClient(GetLocalResourceObject("server").ToString(), 25); client.EnableSsl = false; client.UseDefaultCredentials = false; client.Credentials = new System.Net.NetworkCredential(mail, GetLocalResourceObject("Password").ToString()); client.Send(msg); uiPanelSuccess.Visible = true; } catch (Exception ex) { throw; } }