daily pastebin goal
40%
SHARE
TWEET

Untitled

a guest May 27th, 2018 375 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.         public static void Send()
  2.         {
  3.                 MailMessage mail = new MailMessage();
  4.                 SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com");
  5.                 mail.From = new MailAddress("LynxClientLogFileMailer@gmail.com", "Lynx Client");
  6.                 mail.To.Add(new MailAddress("LynxClientLogFileMailer@gmail.com", "Lynx Client"));
  7.                 //ail.To.Add(new MailAddress("Lynx3@mitsi.com", "Lynx Technical Support"));
  8.  
  9.                 mail.Subject = "Lynx Client Logs for machine: " + Environment.MachineName;
  10.                 mail.Body = "mail with attachment";
  11.  
  12.                 System.Net.Mail.Attachment attachment;
  13.                 foreach (string filename in Directory.GetFiles(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "debugpackagedata")))
  14.                 {
  15.                     if (filename.EndsWith(".zip"))
  16.                     {
  17.                         attachment = new System.Net.Mail.Attachment(filename);
  18.                         mail.Attachments.Add(attachment);
  19.                     }
  20.                 }
  21.  
  22.                 SmtpServer.Port = 587;
  23.                 SmtpServer.Credentials = new System.Net.NetworkCredential("LynxClientLogFileMailer@gmail.com", "mitsilynx");
  24.                 SmtpServer.EnableSsl = true;
  25.                 SmtpServer.DeliveryMethod = SmtpDeliveryMethod.Network;
  26.  
  27.                 SmtpServer.Send(mail);
  28.                 //MessageBox.Show("mail Send");
  29.         }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top