Submitted by chgerwig on Mon, 02/26/2018 - 09:27 Pro Licensee
I want to optimize spamassassin and know that this is possible to run a sa-learn command with the option --spam through the spam folder. I know that spam mails are put there from spamassassin, but spamassassin does not recognize the spam mails which the user - which uses IMAP - has moved there. Also the other way round this command with the --ham option should be used in the inbox, if the user moved some good mails from the spam folder to the inbox.
Any suggestions how I can do this with a script for all users on my server?
Best reagards, Christian
Submitted by andreychek on Mon, 02/26/2018 - 10:34 Comment #1
Howdy -- there isn't an existing script to do that, though it should be possible using the Virtualmin command line tools.
This command here will generate a list of all users on the server, and provide some additional information about each one, such as the home directory:
virtualmin list-users --email-only --all-domains --multiline
From there, you'd just need to parse that output, and use it alongside a tool like sa-learn.
Submitted by chgerwig on Tue, 02/27/2018 - 04:07 Pro Licensee Comment #2
Thanks for the suggestion. 1. it is still not easy to manage this for me because I am not a script programmer 2. the suggested command maybe wrong, because I got a long list with all details like shown below: ipv6 Domain: gerwig.at Unix username: firstname.lastname@example.org Real name: Encrypted password: dfasdf Disabled: No Home directory: /home/gerwig/homes/ipv6 FTP access: No Login permissions: Email only Shell: /dev/null User type: Normal user Home quota: 100 MB Home quota used: 144 kB Home byte quota: 104857600 Home byte quota used: 147456 Mail location: /home/gerwig/homes/ipv6/Maildir Mail storage type: Maildir Email address: email@example.com Check spam and viruses: Yes
Submitted by andreychek on Tue, 02/27/2018 - 10:09 Comment #3
Yeah unfortunately, what you're asking for isn't a feature Virtualmin supports.
With the Virtualmin command line tools, someone savvy with scripting could do it, but it'd still be a bit of a project.
The command I shared provides a bunch of data -- someone taking on this particular task would need to parse through all the data, and grab the portions they need (such as the username and home directory location).
We unfortunately aren't able to code that ourselves, but there may be folks on the Forums who would offer to build such a script.
Submitted by JamieCameron on Wed, 02/28/2018 - 22:20 Comment #4
One command you might find useful is
virtualmin list-mailbox --domain whatever.com --user bob --folder Span, which will dump all his spam as output.