/// <summary> /// Verstuur de log naar de mailserver van de CDR /// </summary> /// <param name="fromEmailAdress"></param> /// <param name="extraMessage"></param> /// <returns></returns> static public bool SendSmtpOfMemoryLog(string toEmailAdress, string extraMessage) { if (string.IsNullOrEmpty(smtpServer) || string.IsNullOrEmpty(toEmailAdress)) { return(false); } try { if (memoryLogger != null) { SmtpClient smtpClient = new SmtpClient(); smtpClient.Host = smtpServer; smtpClient.Timeout = 30 * 1000; // 30 seconden timeout max LogEntry[] logEntries = memoryLogger.GetLog(); StringBuilder message = new StringBuilder(logEntries.Length * 1024); if (extraMessage != null && extraMessage.Length > 0) { message.Append(extraMessage); message.Append("\r\n\r\n------------------------------------------------------------\r\n\r\n"); } message.Append(SystemSettings()); foreach (LogEntry log in logEntries) { message.Append(memoryLogger.Formatter.AsString(log) + "\r\n"); } //foreach string AppName = Path.GetFileName(Path.ChangeExtension(Assembly.GetExecutingAssembly().Location, null)); // En verstuur het (hopelijk geen firewall of smtpClient.Send(toEmailAdress, toEmailAdress, AppName + " log", message.ToString()); return(true); } } catch { } return(false); }