First lets download the plugin and install it.


# cd /usr/local/www/roundcube/plugins
# fetch https://github.com/JohnDoh/Roundcube-Plugin-Mark-as-Junk-2/archive/master.zip
# unzip master.zip
# mv Roundcube-Plugin-Mark-as-Junk-2-master markasjunk2
# cd /usr/local/www/roundcube/config
# vi config.inc.php

look for plugins array:


$config['plugins'] = array(
'archive',
'zipdownload',
'managesieve',
'jqueryui',
'recipient_to_contact',

add 'markasjunk2' as follows


$config['plugins'] = array(
'archive',
'zipdownload',
'managesieve',
'jqueryui',
'recipient_to_contact',
'markasjunk2'

Save and Exit. Now copy the default config.inc.php so this will work properly.


# cd /usr/local/www/roundcube/plugins/markasjunk2
# cp config.inc.php.dist config.inc.php

The defaults are fine. No changes are needed. When you mark an email as Spam it will try to move it to a Junk folder which will not exist. To make this seamless for your users we will need to create a symbolic link for .Junk to point to spam. We can do this in the ~vpopmail/skel folder as follows:


# cd ~vpopmail/skel/Maildir
# ln -s .Spam/ .Junk

The following section is optional. If you would like to see users' read Spam messages you can direct the read messages to a master spambox or just put this in a postmaster mailbox. It's entirely up to you.

Lets add spambox@testdomain.com first


# ~vpopmail/bin/vadduser spambox@testdomain.com

Now lets create a symbolic link to the spambox Junk folder.


# cd ~vpopmail/skel/Maildir/.Junk
# rm -R cur

change spambox to the sa-learn catchall user for all domains


# ln -s /usr/home/vpopmail/domains/testdomain.com/spambox/Maildir/cur cur

Special thanks to Steve Donohue