public class EmailClass
{
public void SendMail(string mailFrom, string mailTo, string copyTo)
{
mail = new MailMessage();
mail.From = mailFrom;
mail.To = mailTo;
mail.Cc = copyTo;
mail.Subject = this.subject;
mail.Attachments.Add(new MailAttachment("c:\test.txt");
mail.Body = this.body;
mail.Priority = MailPriority.High;
mail.BodyFormat = MailFormat.html;
SmtpMail.SmtpServer = "172.16.0.23";
//You also need to add this code to send to someone else if file size
//is 0
if(new FileInfo(c:\test.txt)==0)
{
mail.To = "someoneElse@someoneelse.com";
}
SmtpMail.Send(mail);
}
}
The method should be in a class.
I think you should read up on some basic .Net programming
Email Notification Framework[
^]