MailMessage email = new MailMessage(fromEmail, ToEmail);
email.Subject = subject;
email.CC.Add(toEmailCC);
email.IsBodyHtml = true;
email.Body = body; // your body content in HTML
SmtpClient sMail = new SmtpClient("YourSmtpServer");
sMail.DeliveryMethod = SmtpDeliveryMethod.Network;
sMail.Credentials = new NetworkCredential("YourUserIfNeeded", "YourPasswordIfNeeded");
Attachment item = new Attachment(filename); //if any
email.Attachments.Add(item);
sMail.Send(email);
|