Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > ISPConfig 2 > Tips/Tricks/Mods

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old 22nd September 2007, 19:25
grant grant is offline
Junior Member
Join Date: Sep 2007
Posts: 14
Thanks: 0
Thanked 15 Times in 4 Posts
Default Move junk mail to a folder instead of deleting

With SpamAssassin turned on, the default spam strategy options let you either leave junk mail in your inbox (accept), or delete it completely (discard).

I hate having my mail deleted for me. I rarely have false positives, but I'd rather see the junk mail I'm getting to be able to make sure.

These changes allow you to change the behavior to either:
  • Leave it in your inbox
  • Move it to the Junk folder

This guide also assumes that your clients are using IMAP to access their mail, or at least have access to a web client that is using IMAP, so they can see the Junk folder. It also assumes that you are using Maildirs.

First change the behavior of spamassassin. Edit /root/ispconfig/isp/conf/spamassassin.rc.master.
Find the line:
PHP Code:
Change it to:
PHP Code:

Now make sure that the Junk folders are created automatically. We can't move mail to a folder that doesn't exist. Edit /root/ispconfig/scripts/lib/classes/ispconfig_procmail.lib.php.
Find the line (around 107) that reads:
PHP Code:
if(!is_dir($web_path."/user/".$user_username."/Maildir")) $mod->log->caselog("maildirmake ".$web_path."/user/".$user_username."/Maildir &> /dev/null""maildirmake ".$web_path."/user/".$user_username."/Maildir &> /dev/null"__LINE__); 
Below it add:

PHP Code:
# Create Junk, Send, Trash folders
if(!is_dir($web_path."/user/".$user_username."/Maildir/.Junk")) $mod->log->caselog("maildirmake -f Junk ".$web_path."/user/".$user_username."/Maildir &> /dev/null""maildirmake -f Junk ".$web_path."/user/".$user_username."/Maildir &> /dev/null"__LINE__);
is_dir($web_path."/user/".$user_username."/Maildir/.Sent")) $mod->log->caselog("maildirmake -f Sent ".$web_path."/user/".$user_username."/Maildir &> /dev/null""maildirmake -f Send ".$web_path."/user/".$user_username."/Maildir &> /dev/null"__LINE__);
is_dir($web_path."/user/".$user_username."/Maildir/.Trash")) $mod->log->caselog("maildirmake -f Trash ".$web_path."/user/".$user_username."/Maildir &> /dev/null""maildirmake -f Trash ".$web_path."/user/".$user_username."/Maildir &> /dev/null"__LINE__); 
(The forums are doing some weird wrapping on that code. The 3 if statements should be on 1 line each.)

Edit /home/admispconfig/ispconfig/web/isp_manager/lib/lang/en.lng
Find the lines:
PHP Code:
$wb["accept"] = 'accept';
$wb["discard"] = 'discard'
Change them to:
PHP Code:
$wb["accept"] = 'Leave in Inbox';
$wb["discard"] = 'Move to Junk'
Edit /home/admispconfig/ispconfig/web/mailuser/lib/lang/en.lng
Find the lines:
PHP Code:
$wb["txt_accept"] = "accept";
$wb["txt_discard"] = "discard"
Change them to:
PHP Code:
$wb["txt_accept"] = "Leave in Inbox";
$wb["txt_discard"] = "Move to Junk"
Now make a small change to in ISPConfig to make it refresh all your users. It should automatically create Junk, Sent and Trash folders for everyone. When then change their spam settings, they will now see the options "Leave in Inbox" and "Move to Junk" instead of accept and discard.
Reply With Quote
The Following 10 Users Say Thank You to grant For This Useful Post:
chancer (17th October 2007), dauz (18th November 2007), deathshadow (25th March 2008), falko (23rd September 2007), goldstift (18th January 2008), jbravo (19th November 2007), madmucho (14th October 2007), MTvermoes (20th January 2008), torusturtle (5th October 2007), wa4bro (25th October 2008)
Sponsored Links


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Postfix & mail forwarding loop varnik Server Operation 21 9th December 2008 16:13
Postfix reject connections gabrix Server Operation 27 25th January 2007 09:37
postfix-tls sasl2 mysql courier-authmysql gabrix Server Operation 4 12th January 2007 23:09
Core 4: Error Messages on Fresh Install re CTX/SSL jjw Installation/Configuration 30 6th September 2006 13:16
Virtual Users And Domains With Postfix, Courier And MySQL (+ SMTP-AUTH, Quota, SpamAs ebbay Installation/Configuration 9 4th March 2006 12:47

All times are GMT +2. The time now is 06:29.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.