public void SendMailNew(string mailTo, string Body, string Subject, string filepath) { try { MailMessage msg = new MailMessage(); msg.IsBodyHtml = false; msg.Subject = Subject; msg.Body = Body; msg.From = new MailAddress("xxxxxxxxxxxxxxxxx"); string[] multiId = mailTo.Split(';'); foreach (string mailid in multiId) { if (mailid.Length != 0) { msg.To.Add(new MailAddress(mailid)); } } msg.Attachments.Add(new Attachment(filepath)); SmtpClient smtp = new SmtpClient(); smtp.Host = "Smtp.gmail.com"; smtp.Port = 587; smtp.EnableSsl = true; string Password = ConfigurationManager.AppSettings["SMSPASSWORD"]; NetworkCredential nc = new NetworkCredential("xxxxxxxxxxxxx", Password); smtp.Credentials = nc; smtp.Send(msg); } catch (Exception ex) { throw ex; } }
catch (Exception ex) { throw ex; }
throw;
throw ex;
try..catch
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)