Difference between revisions of "Make-forwards.pl"

From Organic Design wiki
m (moved Make-forwards.sh to Make-forwards.pl: oops perl now not shell)
(Category:PERL {{svn}})
 
Line 1: Line 1:
 +
{{lowercase}}{{svn|tools|make-forwards.pl}}
 
Use this script to create ''.forward'' files for all users who don't already have them. The files created automatically route emails marked as spam into the users ''Trash'' IMAP folder. See [[Configure mail server]] for more details.
 
Use this script to create ''.forward'' files for all users who don't already have them. The files created automatically route emails marked as spam into the users ''Trash'' IMAP folder. See [[Configure mail server]] for more details.
{{code|<perl>
+
[[Category:PERL]]
#!/usr/bin/perl
 
 
 
$filter = '# Exim filter
 
if
 
$h_X-Spam-Status: CONTAINS "Yes"
 
or
 
"${if def:h_X-Spam-Flag {def}{undef}}" is "def"
 
then
 
save $home/Maildir/.Trash/
 
finish
 
endif';
 
 
 
for ( glob "/home/*" ) {
 
$file = "$_/.forward";
 
if ( ! -e $file ) {
 
s|^.+/||;
 
qx( echo '$filter' > $file );
 
qx( chown $_:$_ $file );
 
}
 
}
 
</perl>}}
 

Latest revision as of 13:02, 8 December 2011

Info.svg This code is in our Git repository here.

Note: If there is no information in this page about this code and it's a MediaWiki extension, there may be something at mediawiki.org.

Use this script to create .forward files for all users who don't already have them. The files created automatically route emails marked as spam into the users Trash IMAP folder. See Configure mail server for more details.