Using iOS's Junk mail folder alongside Spam

Problem Description

Plesk only scans the folder called "Spam" for its bayesian filtering. In other words, if you want your spam filter to learn from your spam and improve over time, then you *must* use the folder called "Spam" and not "Junk" or any other name.

Unfortunately MacOS defaults to folders called "Junk" and iOS devices will *only* use a folder called "Junk", with no ability to override that config like other mail apps typically have (including the Mail app on MacOS).

Problem Resolution

Please note that the solution to this can only be applied on your own dedicated VPS where you have root access. If you have a shared hosting account or reseller account, the only solution is to specify the Spam folder be your official spam folder. On iOS you can choose to "Move" junk messages to the Spam folder rather than Flag them as spam. It's one extra step each time, but it solves the problem.

If you have your own VPS, or essentially any machine with root access running Plesk or even simply Dovecot, you can go to the mail folder and alias the Junk folder to the Spam folder like this:

cd /var/qmail/mailnames/<domain>/<username>/Maildir/
ln -s .Spam .Junk
chown -R popuser:popuser .Junk


You must, of course, replace the <domain> and <username> with the actual email account parts. For example, if your email address is john@smith.com then the domain is smith.com and the username is john.

This solution creates a symbolic link that aliases the Junk folder to the Spam folder. Once this change is completed, you will see both a Junk and a Spam folder in your IMAP mailbox list on each of your mail clients, as well as in webmail. Be sure not to delete either of them! Both folders will have the same mail content, but don't worry, it is not duplicated; each folder is simply showing the same contents on the server's file system.

With this tweak, you will be able to send spam to either the Spam or Junk folder and the messages will all end up in the same place and all will be scanned by Plesk's spam learning system.
  • 0 Users Found This Useful