Added: FS#873 - Option to redirect spam into a .Junk directory
5 files modified
1 files added
| | |
| | | `homedir` varchar(255) NOT NULL, |
| | | `autoresponder` enum('n','y') NOT NULL default 'n', |
| | | `autoresponder_text` mediumtext NULL, |
| | | `move_junk` enum('n','y') NOT NULL default 'n', |
| | | `custom_mailfilter` mediumtext, |
| | | `postfix` enum('n','y') NOT NULL, |
| | | `access` enum('n','y') NOT NULL, |
| | |
| | | ################################## |
| | | # Begin Datatable fields |
| | | ################################## |
| | | |
| | | 'move_junk' => array ( |
| | | 'datatype' => 'VARCHAR', |
| | | 'formtype' => 'CHECKBOX', |
| | | 'default' => 'n', |
| | | 'value' => array(0 => 'n',1 => 'y') |
| | | ), |
| | | ################################## |
| | | # ENDE Datatable fields |
| | | ################################## |
| | |
| | | $wb["disablepop3_txt"] = 'Disable POP3'; |
| | | $wb["duplicate_alias_or_forward_txt"] = 'There is already an alias or forwrd with this email address.'; |
| | | $wb["quota_error_value"] = 'Invalid quota value. Allowed values are: 0 for unlimited or numbers > 1'; |
| | | $wb["move_junk_txt"] = 'Move Spam Emails to Junk directory'; |
| | | ?> |
| | |
| | | |
| | | <div class="pnl_formsarea"> |
| | | <fieldset class="inlineLabels"> |
| | | <div class="ctrlHolder"> |
| | | <p class="label">{tmpl_var name='move_junk_txt'}</p> |
| | | <div class="multiField"> |
| | | {tmpl_var name='move_junk'} |
| | | </div> |
| | | </div> |
| | | </fieldset> |
| | | |
| | | {tmpl_var name='filter_records'} |
New file |
| | |
| | | |
| | | SPAMDIR="Junk" |
| | | SPAMDIRFULL="$DEFAULT/.Junk" |
| | | |
| | | if ( /^X-Spam-Flag: YES$/ ) |
| | | { |
| | | exception { |
| | | |
| | | `test -e $SPAMDIRFULL` |
| | | if ( $RETURNCODE != 0 ) |
| | | { |
| | | `maildirmake -f $SPAMDIR $DEFAULT` |
| | | `chown vmail:vmail -R $SPAMDIRFULL` |
| | | `chmod 0700 $SPAMDIRFULL` |
| | | `echo INBOX.$SPAMDIR >> $DEFAULT/courierimapsubscribed` |
| | | } |
| | | to "$SPAMDIRFULL/" |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | // Write the custom mailfilter script, if mailfilter recipe has changed |
| | | if($data["old"]["custom_mailfilter"] != $data["new"]["custom_mailfilter"]) { |
| | | if($data["old"]["custom_mailfilter"] != $data["new"]["custom_mailfilter"] or |
| | | $data["old"]["move_junk"] != $data["new"]["move_junk"]) { |
| | | $app->log("Mailfilter config has been changed",LOGLEVEL_DEBUG); |
| | | if(trim($data["new"]["custom_mailfilter"]) != '') { |
| | | // Delete the old filter recipe |
| | |
| | | $email_parts = explode("@",$data["old"]["email"]); |
| | | } |
| | | $config_file_path = $this->mailfilter_config_dir.'/'.$email_parts[1].'/'.$email_parts[0].'/.mailfilter'; |
| | | file_put_contents($config_file_path,$data["new"]["custom_mailfilter"]); |
| | | |
| | | $mailfilter_content = ''; |
| | | if($data["new"]["move_junk"] == 'y') { |
| | | $mailfilter_content .= file_get_contents($conf["rootpath"].'/conf/mailfilter_move_junk.master')."\n"; |
| | | } |
| | | $mailfilter_content .= $data["new"]["custom_mailfilter"]; |
| | | |
| | | file_put_contents($config_file_path,$mailfilter_content); |
| | | $app->log("Writing new custom Mailfiter".$config_file_path,LOGLEVEL_DEBUG); |
| | | exec("chmod 770 $config_file_path"); |
| | | exec("chown vmail $config_file_path"); |