View Single Post
Old 25th January 2012, 10:22
mike_p mike_p is offline
Senior Member
Join Date: Mar 2010
Location: Surrey, England
Posts: 140
Thanks: 9
Thanked 28 Times in 17 Posts

Time to revisit this!

I've just had to troubleshoot some mail problems and found the standard mail log presentation very poor. Having updated ISPConfig since my last look at mail problems, my changes had been lost.

I'm running on Centos, so for some strange reason ISPConfig decides to use/show the main maillog for warnings and errors.

Almost worse, because it shows the logs without replacing HTML entitities, the display of email addresses in the logs gets mangled.
example: some mail log messages show email addresses as
because of the bracketing ('<'..'>') webbrowsers will assume an unknown html tag and not show the content.

So as in the first post in this thread (with one small change) I recommend adding this to show_log.php
function log_to_table($datastring) {
  $data_lines = explode("\n", $datastring);
  $html = "<table class='log_table'>";
  foreach ($data_lines as $value) {
    $items = explode(' ',htmlentities($value),6);
    $html .= "<tr>";
    $html .= "<td>$items[0] $items[1]</td>"; //date
    $html .= "<td>$items[2]</td>"; //time
    $html .= "<td>$items[3]</td>"; //server
    $html .= "<td>$items[4]</td>"; //user
    $html .= "<td>$items[5]</td>"; //data
    $html .= "<tr>";
  $html .= "</table>";
  return $html;
Then replace
$logData = nl2br($data);
$logData = log_to_table($data);
then follow the instructions for adding to the css
The second change was to ensure that the warnings and logs are in separate logs. /the instructions remainthe same as my original post except the changes to should now be made to instead.

Last edited by mike_p; 25th January 2012 at 10:32.
Reply With Quote