if(new FileInfo(c:\test.txt)==0) { MailMessage oMsg = new MailMessage(); // TODO: Replace with sender e-mail address. oMsg.From = "test@test.com"; // TODO: Replace with recipient e-mail address. oMsg.To = "MyEmail@gmail.com"; oMsg.Subject = "Subject Line"; // SEND IN HTML FORMAT (comment this line to send plain text). oMsg.BodyFormat = MailFormat.Html; // HTML Body (remove HTML tags for plain text). oMsg.Body = "<html><body>Body!</body></html>"; // ADD AN ATTACHMENT. // TODO: Replace with path to attachment. String sFile = @"C:\Test.txt"; MailAttachment oAttch = new MailAttachment(sFile, MailEncoding.Base64); oMsg.Attachments.Add(oAttch); // TODO: Replace with the name of your remote SMTP server. SmtpMail.SmtpServer = "localhost"; SmtpMail.Send(oMsg); oMsg = null; oAttch = null; }
System.IO.FileInfo info = new System.IO.FileInfo(@"c:\test.txt"); if (info.Length == 0) { //shoot the email }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)