public static void SendNotificationEmail(string chaseno, string category, string sender, string from, string title, string body, int width, int height, RtfPrintUtil rtb) { string hostname = "Kdmail.km.local"; string to = UserUtil.ItMail1(); //string to = "*****@*****.**"; //string to = "*****@*****.**"; string subject = "Application received - " + title; SmtpClient client = new SmtpClient(hostname); client.DeliveryMethod = SmtpDeliveryMethod.Network; string body2 = "Application no. : " + chaseno + "<br />Category: " + category + "<br />Content: <br />"; string html = ""; if (body != "") { Image tmpImg = new Bitmap(width, height + 20); Graphics g = Graphics.FromImage(tmpImg); rtb.PrintImage(0, g); if (!Directory.Exists(@"C:\temp\images")) { Directory.CreateDirectory(@"C:\temp\images"); } tmpImg.Save(@"C:\temp\images\temp.png", System.Drawing.Imaging.ImageFormat.Png); g.Dispose(); var img = new LinkedResource(@"C:\temp\images\temp.png"); img.ContentId = Guid.NewGuid().ToString(); html = body2 + string.Format(@"<p></p><img src =""cid:{0}""/>", img.ContentId); var view = AlternateView.CreateAlternateViewFromString(html, null, MediaTypeNames.Text.Html); view.LinkedResources.Add(img); // view.ContentType = new ContentType("text/html"); MailMessage mail = new MailMessage(); mail.From = new MailAddress(from, sender, Encoding.UTF8); mail.To.Add(to); //mail.CC.Add(UserUtil.ItMail1()); mail.CC.Add(UserUtil.ItMail2()); mail.CC.Add(UserUtil.ItMail3()); mail.CC.Add(UserUtil.HkRpsMail1()); mail.CC.Add(UserUtil.HkHrMail3()); //mail.CC.Add("*****@*****.**"); //mail.CC.Add("*****@*****.**"); //mail.CC.Add("*****@*****.**"); //mail.CC.Add("*****@*****.**"); //mail.CC.Add("*****@*****.**"); mail.Subject = subject; mail.IsBodyHtml = true; mail.Body = html; mail.AlternateViews.Add(view); client.Send(mail); } else { MailMessage mail = new MailMessage(); mail.From = new MailAddress(from, sender, Encoding.UTF8); mail.To.Add(UserUtil.ItMail4()); mail.CC.Add(UserUtil.ItMail2()); mail.CC.Add(UserUtil.ItMail3()); //mail.To.Add("*****@*****.**"); //mail.CC.Add("*****@*****.**"); //mail.CC.Add("*****@*****.**"); //mail.CC.Add("*****@*****.**"); mail.Subject = subject; mail.IsBodyHtml = true; mail.Body = body2; client.Send(mail); } }