In the code that you show,
MailMessage mis = new MailMessage();
SmtpClient smtpserver = new SmtpClient("smtp.gmail.com");
smtpserver.Credentials = new System.Net.NetworkCredential("rajesh@gmail.com","12345");
smtpserver.Host = "smtp.gmail.com";
smtpserver.Port = 587;
smtpserver.EnableSsl = true;
mis.From = new MailAddress("rajesh@gmail.com", "Report");
mis.IsBodyHtml = true;
mis.To.Add("rajesh@gmail.com");
mis.CC.Add(new MailAddress("rajesh@gmail.com"));
mis.Subject = "Data Dump Report";
smtpserver.Send(mis);
Where exactly are you attaching the Excel file? Secondly,
Quote:
when i run the above code, in mail i getting only subject as Data Dump Report.
Where exactly, are you adding anything other than the subject? The body is missing, attachments are missing and that is why you don't get anything other than that.
Start by adding the following lines,
mis.Body = "<p>This email contains attachment for an Excel spreadsheet.</p>";
mis.Attachments.Add(new Attachment("C:\Path\To\ExcelFile.xls"));
Finally, the email would be sent using the body content and the attachments attached to the email.
For more, please read:
Attachment Constructor (String) (System.Net.Mail)[
^]
MailMessage.Attachments Property (System.Net.Mail)[
^]