public static void SendMailMessageWithAttachment(string to, string subject, string message,Attachment doc )
{
try
{
MailMessage mailMsg = new MailMessage();
result = to.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
for (int count = 0; count < result.Length; count++)
{
mailMsg.To.Add(new MailAddress(result[count]));
}
mailMsg.From = new MailAddress(ConfigurationManager.AppSettings["FromEmail"]);
mailMsg.Subject = subject;
mailMsg.Body = message;
mailMsg.Attachments.Add(doc);
mailMsg.IsBodyHtml = true;
SmtpClient smtpClient = new SmtpClient();
smtpClient.Send(mailMsg);
}
catch (Exception exc)
{
}
}