Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void Send()
- {
- MailMessage mail = new MailMessage();
- SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com");
- mail.From = new MailAddress("LynxClientLogFileMailer@gmail.com", "Lynx Client");
- mail.To.Add(new MailAddress("LynxClientLogFileMailer@gmail.com", "Lynx Client"));
- //ail.To.Add(new MailAddress("Lynx3@mitsi.com", "Lynx Technical Support"));
- mail.Subject = "Lynx Client Logs for machine: " + Environment.MachineName;
- mail.Body = "mail with attachment";
- System.Net.Mail.Attachment attachment;
- foreach (string filename in Directory.GetFiles(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "debugpackagedata")))
- {
- if (filename.EndsWith(".zip"))
- {
- attachment = new System.Net.Mail.Attachment(filename);
- mail.Attachments.Add(attachment);
- }
- }
- SmtpServer.Port = 587;
- SmtpServer.Credentials = new System.Net.NetworkCredential("LynxClientLogFileMailer@gmail.com", "mitsilynx");
- SmtpServer.EnableSsl = true;
- SmtpServer.DeliveryMethod = SmtpDeliveryMethod.Network;
- SmtpServer.Send(mail);
- //MessageBox.Show("mail Send");
- }
Add Comment
Please, Sign In to add comment