How to flag released spam with new color!

Questions and answers about how to do stuff
Post Reply
z3us
Posts: 8
Joined: 22 Jul 2016 17:10

How to flag released spam with new color!

Post by z3us »

When releasing e-mails, the mail doesn't get flagged as 'released', the status remains spam, or high spam etc.
I made some adjustments in PHP and added a column in the mailscanner database to add this option.
When releasing an e-mail, the mail gets blue highlighted in the mail listings :D

Add column to SQL database mailscanner:

Code: Select all

ALTER TABLE  `maillog` ADD  `isreleased` TINYINT( 1 ) NULL DEFAULT  '0';
Add the following code into your Style.css:

Code: Select all

TABLE.mail TR.released {
    background-color:#40C1ED;
    color:#000;
}
TABLE.mail TD.released {
    background-color:#40C1ED;
    width:15px;
}
Then edit the following PHP pages:
status.php | rep_message_listing.php | rep_message_ops.php

search for:

Code: Select all

	$sql .= "
	 to_address,
	 subject,
	 size as size,
	 isspam,
 ishighspam,
add this row into it:

Code: Select all

 isreleased,
functions.php
search for:

Code: Select all

	echo '    <tr> <td>' . __('blacklisted03') . '</td> <td class="blacklisted"></td> </tr>' . "\n";
echo '        <tr> <td>' . __('notverified03') . '</td> <td class="notscanned"></td> </tr>' . "\n";
add this row:

Code: Select all

echo '        <tr> <td>Released</td> <td class="released"></td> </tr>' . "\n";
search for:

Code: Select all

case 'time':
                    $fieldname[$f] = 'Time';
                    break;
                case 'headers':
                    $display[$f] = false;
                    break;
add right after this:

Code: Select all

	case 'isreleased':
                    $display[$f] = false;
                    break;
search for:

Code: Select all

 $blacklisted = false;
            $mcp = false;
            $highmcp = false;
add the following:

Code: Select all

$released = false;
search for:

Code: Select all

case 'clienthost':
                        $hostname = gethostbyaddr($row[$f]);
                        if ($hostname == $row[$f]) {
                            $row[$f] = "(Hostnaam opvragen mislukt)";
                        } else {
                            $row[$f] = $hostname;
                        }
                        break;
add after this:

Code: Select all

	case 'isreleased':
                        if ($row[$f] == 'Y' || $row[$f] > 0) {
                            $released = true;
			// $status_array = array();
			array_push($status_array, 'Vrijgegeven');
                        }
                        break;
search for:

Code: Select all

 // Colorise the row
 	switch (true) { 
add right after this:

Code: Select all

	case $released:
                    echo '<tr class="released">' . "\n";
                    break;
detail.php
search for:

Code: Select all

CASE WHEN spamwhitelisted>0 THEN '$yes' ELSE '$no' END AS '" . __('spamwl04') . "',
	  CASE WHEN spamblacklisted>0 THEN '$yes' ELSE '$no' END AS '" . __('spambl04') . "',
	  spamreport AS '" . __('saautolearn04') . "',
  sascore AS '" . __('sascore04') . "',
add this right after:
CASE WHEN isreleased>0 THEN '$yes' ELSE '$no' END AS 'Released:',
search for:

Code: Select all

 // Release
        if (isset($_GET['release'])) {
add right after:

Code: Select all

			$sqlunsetspam = "UPDATE maillog SET `isreleased` = '1', `quarantined` = '0' WHERE  `maillog`.`id` ='$url_id'";
                            dbquery($sqlunsetspam);
                    if (DEBUG == 'true') {
                        echo $sqlunsetspam;
                    }
I believe these options should be in the next release, because we need to know whether an e-mail is already released in the mailwatch interface as well as in the quarantine reports.

Cya!
User avatar
Dominion
Posts: 3
Joined: 08 Dec 2016 06:44

Re: How to flag released spam with new color!

Post by Dominion »

vote for next release :dance:
Greetz,
Dominion
z3us
Posts: 8
Joined: 22 Jul 2016 17:10

Re: How to flag released spam with new color!

Post by z3us »

Dominion wrote:vote for next release :dance:
Hehe thx mate! 8-)
User avatar
pdwalker
Posts: 1553
Joined: 18 Mar 2015 09:16

Re: How to flag released spam with new color!

Post by pdwalker »

It you want to see it in a future release, you can submit it as a feature request to the mailscanner/mailwatch project on github
Post Reply