I would like to document an issue I have had in the hopes of gaining enough support to see a fix.
I will update this post if any updates arise.
The Issue:
When making use of the SpamAssassin Spam Box feature, Exim is configured to send everything to .spam, but Roundcube creates a default folder '.Junk' instead of matching '.spam', forcing the user to manually subscribe to the new, true, spam folder. This causes a bunch of confusion for the average user.
Possible fix 1:
Force the creation of the new '.spam' folder (instead of waiting for first spam) and symlink to .Junk
Issue: clients that do not respect subscriptions will show users both folders
Current Working Fix: (with added bonus)
1) Turn off SpamAssassin Auto-delete
2) Turn on SpamAssassin Spam Box
You will now need a way to automate your users subscribing to it, moving emails, and deleting the old folder(s). This can easily be done with a roundcube plugin.
3) Create a folder for your new plugin
4) Edit /usr/local/cpanel/base/3rdparty/roundcube/plugins/folderfix/folderfix.php with your favorite editor, adding the following:
5) Edit /usr/local/cpanel/base/3rdparty/roundcube/config/main.inc.php to match the following:
Now, when a user logs in, the script will check to make sure the user has and is subscribed to all the "special folders" (drafts, sent, etc)
Obviously cPanel is going to write over all this upon update, so we need to follow the official guide for deploying a custom roundcube package.
I plan to look into a command line solution for all those Mac Mail/Thunderbird/etc users.
Check back for updates and help me make this a known issue... maybe they will put out an official fix
I will update this post if any updates arise.
The Issue:
When making use of the SpamAssassin Spam Box feature, Exim is configured to send everything to .spam, but Roundcube creates a default folder '.Junk' instead of matching '.spam', forcing the user to manually subscribe to the new, true, spam folder. This causes a bunch of confusion for the average user.
Possible fix 1:
Force the creation of the new '.spam' folder (instead of waiting for first spam) and symlink to .Junk
Issue: clients that do not respect subscriptions will show users both folders
Current Working Fix: (with added bonus)
1) Turn off SpamAssassin Auto-delete
2) Turn on SpamAssassin Spam Box
You will now need a way to automate your users subscribing to it, moving emails, and deleting the old folder(s). This can easily be done with a roundcube plugin.
3) Create a folder for your new plugin
Code:
# mkdir /usr/local/cpanel/base/3rdparty/roundcube/plugins/folderfix
# touch /usr/local/cpanel/base/3rdparty/roundcube/plugins/folderfix/folderfix.php
# chown -R root:wheel /usr/local/cpanel/base/3rdparty/roundcube/plugins/folderfix
Code:
<?php
/*
* folderfix plugin
*
* this plugin moves emails and deletes spam folders that don't fit cPanel's .spam design
*/
class folderfix extends rcube_plugin {
public $task = 'login';
function init() {
$this->add_hook( 'login_after', array($this, 'fix_folders') );
}
function fix_folders($args) {
$rcmail = rcmail::get_instance();
// create special folders on every login
$specialfolders = array( 'drafts_mbox', 'junk_mbox', 'sent_mbox', 'trash_mbox' );
foreach( $specialfolders as $folder ) {
if( $rcmail->config->get($folder) ) {
$foldername = $rcmail->config->get($folder);
if( !$rcmail->imap->mailbox_exists($foldername) )
$rcmail->imap->create_mailbox($foldername, true);
else if( !$rcmail->imap->mailbox_exists($foldername, true) )
$rcmail->imap->subscribe($foldername);
}
}
if( $rcmail->imap->mailbox_exists('INBOX.Junk') ) {
$rcmail->imap->move_message( '*', 'INBOX.spam', 'INBOX.Junk' );
$rcmail->imap->delete_mailbox('INBOX.Junk');
}
else if( $rcmail->imap->mailbox_exists('INBOX.junk') ) {
$rcmail->imap->move_message( '*', 'INBOX.spam', 'INBOX.junk' );
$rcmail->imap->delete_mailbox('INBOX.junk');
}
else if( $rcmail->imap->mailbox_exists('INBOX.Spam') ) {
$rcmail->imap->move_message( '*', 'INBOX.spam', 'INBOX.Spam' );
$rcmail->imap->delete_mailbox('INBOX.Spam');
}
return $args;
}
}
Code:
...
$rcmail_config['junk_mbox'] = 'INBOX.spam';
....
$rcmail_config['plugins'] = array('cpanellogin','cpanellogout','folderfix');
...
Obviously cPanel is going to write over all this upon update, so we need to follow the official guide for deploying a custom roundcube package.
I plan to look into a command line solution for all those Mac Mail/Thunderbird/etc users.
Check back for updates and help me make this a known issue... maybe they will put out an official fix
Last edited: