MailMessage mail = new MailMessage(); SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com"); mail.From = new MailAddress("rajesh@gmail.com"); mail.To.Add("sathish@gmail.com"); mail.Subject = "Test Mail - 1"; mail.Body = "mail with attachment"; System.Net.Mail.Attachment attachment; attachment = new System.Net.Mail.Attachment(@"C:\Users\551386\Desktop\DataDump\Excel.xls"); mail.Attachments.Add(attachment); SmtpServer.Port = 587; SmtpServer.Credentials = new System.Net.NetworkCredential("rajesh@gmail.com", "12345"); SmtpServer.EnableSsl = true; SmtpServer.Send(mail);
SmtpServer.Send(mail);
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)