/// <summary> /// Log a support request with the support provider, including the log file /// and supplied problem description /// </summary> /// <param name="supportEmailAddress">The email address to send the support request to</param> /// <param name="logfileAppenderName">The name of the log file appender as configured in the log4net configuration for the application</param> /// <param name="problemDescription">The user described problem description</param> /// <param name="stepsToReproduce">The user described steps to reproduce the issue</param> /// <param name="allFiles">Flag indicating if all log files should be extracted</param> public void LogSupportRequest(string supportEmailAddress, string logfileAppenderName, string problemDescription, string stepsToReproduce, bool allFiles) { var emailClient = new EmailClient(); emailClient.FromAddress = new MailAddress(WinUtils.CurrentUserEmailAddress(), WinUtils.GetCurrentUserNameWithoutDomain()); var messageBody = string.Format("Problem Description:\n\n{0}\n\n\nSteps to Reproduce:\n\n{1}\n\n", problemDescription, stepsToReproduce); MailMessage message = emailClient.CreateMessage("NOES Support Request from " + System.Environment.MachineName, messageBody); var files = Log4NetExtensions.GetLogFiles(logfileAppenderName, allFiles); // Initialise any progress listeners if (InitialiseSupportProgress != null) { var e = new InitialiseProgressEventArgs() { ElementCount = files.Count }; InitialiseSupportProgress(this, e); } foreach (var logfilePath in files) { var logfileName = Path.GetFileName(logfilePath); using (var stream = new FileStream(logfilePath, FileMode.Open)) { Attachment logfile = emailClient.CreateGzipAttachment(stream, logfileName + ".gz", EmailClient.ApplicationGzip); message.Attachments.Add(logfile); } // Update any progress listeners if (UpdateSupportProgress != null) { UpdateSupportProgress(this, EventArgs.Empty); Application.DoEvents(); } } var supportAddress = new MailAddress(supportEmailAddress); emailClient.SendEmail(message, supportAddress); }