Select by search string
Posted: 22 Aug 2007, 15:39
I was tired of checking my e-mail and reciving all those "Warning: Message XXXX..." or " Undelivered Mail Returned to Sender" or even "Mail delivery failed: returning messag.." and I usally get many of these when I send out news letter.
So instead of downloading them and removing it on my e-mail program I decided to use CMM to do that.
I used to check the "check all" option and them "Delete Selected" but sometimes that would delete important e-mails.
So I wrote a javascript snippet to check only those messages that had a certain string on the subject of the and then check it.
This is good because now I can delete the e-mails before I download them. Take a look below, you can copy and paste it on addon_cmm.cgi:
on cmm: v1.07 go to line 534 where it sais:
and add this bellow it:
now go to line 633, there should be this:
now add this right bellow it:
Now save and replace the addon_cmm.cgi file on the server with this one that you've modified.
Chirpy, I hope you add this on the next version
So instead of downloading them and removing it on my e-mail program I decided to use CMM to do that.
I used to check the "check all" option and them "Delete Selected" but sometimes that would delete important e-mails.
So I wrote a javascript snippet to check only those messages that had a certain string on the subject of the and then check it.
This is good because now I can delete the e-mails before I download them. Take a look below, you can copy and paste it on addon_cmm.cgi:
on cmm: v1.07 go to line 534 where it sais:
Code: Select all
print " }\n";
Code: Select all
print "}\n";
print "RegExp.escape = function(text) {\n";
print " if (!arguments.callee.sRE) {\n";
print " var specials = ['/', '.', '*', '+', '?', '|','(', ')', '[', ']', '{', '}', '\\\\'];\n";
print " arguments.callee.sRE = new RegExp('(\\\\' + specials.join('|\\\\') + ')', 'g');\n";
print " }\n";
print " return text.replace(arguments.callee.sRE, '\\\\\$1');\n";
print "}\n";
print "function selectSearch(){\n";
print " var reg = new RegExp(RegExp.escape(document.listmail.searchFor.value), 'i');\n";
print " for (var x = 0; x < document.listmail.elements.length; x++) {\n";
print " if (document.listmail.elements[x].type == 'checkbox' && document.listmail.elements[x].name != 'checkall') {\n";
print " var trPai = document.listmail.elements[x].parentNode.parentNode;\n";
print " var allTds = trPai.getElementsByTagName('TD');\n";
print " var theLink = allTds[2].getElementsByTagName('A');\n";
print " if( reg.test(theLink[0].innerHTML) ){\n";
print " document.listmail.elements[x].checked = true;\n";
print " }\n";
print " }\n";
print " }\n";
Code: Select all
print "<tr class='$class'><td> </td><td align='center'><input type='checkbox' name='checkall' OnClick='checkme()'>
All</td><td colspan='4'><input type='hidden' name='total' value='$total'><input type='submit' value='Delete Selected'></td></tr>\n";
Code: Select all
print "<tr class='$class'><td align='right'> </td><td> </td><td colspan='4'><input type='text' name='searchFor' /> - <input type='button' value='Select by search' onclick='javascript:selectSearch();' /></td></tr>\n";
Chirpy, I hope you add this on the next version