isbg - scans an IMAP Inbox and runs every entry against SpamAssassin.
isbg --imaphost <hostname> --imapuser <username> [options]
isbg --imaphost <hostname> --imapuser <username> --imaplist [options]
isbg (-h | --help)
isbg scans an IMAP Inbox and runs every entry against SpamAssassin. For any entries that match, the message is copied to another folder, and the original marked or deleted.
Works with all common IMAP servers, can do IMAP over SSL, can remember your password, will work painlessly against multiple IMAP accounts and servers, is not involved in the mail delivery process, and so can run on any machine that can contact your IMAP server and has the possibility to skip spam detection to stick only to the teach feature.
- --imaphost hostname
- IMAP server name
- --imapuser username
- Who you login as
- List imap directories
- -h, --help
- Show the help screen
- Show usage information
- Show version information
- Do not actually make any changes
- The spams will be marked for deletion from your inbox
- --deletehigherthan #
- Delete any spam with a score higher than #
- Use exitcodes to detail what happened
- Cause marked for deletion messages to also be deleted (only useful if --delete is specified)
- The spams will be flagged in your inbox
- Delete by copying to '[Gmail]/Trash' folder
- Don't stop if lock file is present
- --imappasswd passwd
- IMAP account password. This however is a really bad idea since any user on the system can run ps and see the command line arguments
- --imapport port
- Use a custom port
- --imapinbox mbox
- Name of your inbox folder [Default: INBOX]
- --learnspambox mbox
- Name of your learn spam folder
- --learnhambox mbox
- Name of your learn ham folder
- Mark learnt messages for deletion
- Flag learnt messages
- Only learn if unflagged (for --learnthenflag)
- Set the lifetime of the lock file to [Default: 240.0]
- --lockfilename file
- Override the lock file name
- --maxsize numbytes
- Messages larger than this will be ignored as they are unlikely to be spam
- --movehamto mbox
- Move ham to folder
- Prevent interactive requests
- Don't include the SpamAssassin report in the message copied to your spam folder
- Don't print stats
- --partialrun num
- Stop operation after scanning 'num' unseen emails [Default: 50]. You can run isbg without --partialrun with --partialrun=0
- --passwdfilename file
- Use a file to supply the password
- Store the password to be used in future runs. This will save the password in a file in your home directory. The file is named .isbg-XXXX where XXXX is a 16 byte identifier based on the IMAP host, username and port number (the same as for the multiple accounts description above). You can override the filename with --passwdfilename. The password is obfuscated, so anyone just looking at the contents won't be able to see what it is. However, if they study the code to isbg then they will be able to figure out how to de-obfuscate it, and recover the original password. (isbg needs the original password each time it is run as well). Consequently you should regard this as providing minimal protection if someone can read the file.
- Use spamc instead of standalone SpamAssassin binary
- --spaminbox mbox
- Name of your spam folder [Default: INBOX.Spam]
- Don't use SSL to connect to the IMAP server
- Don't search spam, just learn from folders
- --trackfile file
- Override the trackfile name
- Show IMAP stuff happening
- Show mail bodies (extra-verbose)
(Your inbox will remain untouched unless you specify --flag or --delete)
Do your first run¶
IMAP password for firstname.lastname@example.org@mail.foo.org:
Will request the password for your user account and store it obfuscated for future use, after login, it will show the IMAP folder list:
Scan your account for spam¶
In future uses you can scan for spam with:
After some time, it will return the stats:
0/0 was automatically deleted
The amount of time it takes will be proportional to the size of your inbox and the amount of mails specified with --partialrun. You can specify --verbose if you want to see the gory details of what is going on.
You can now examine your spam folder and will see what spam was detected. You can change the SpamAssassin threshold in your user_prefs file it created earlier.
isbg remembers which messages it has already seen, so that it doesn't process them again every time it is run. If you are testing and do want it to run again, then remove the trackfile (default $HOME/.cache/isbg/track*).
If you specified --savepw then isbg will remember your password the next time you run against the same server with the same username. You should not specify --savepw in future runs unless you want to change the saved password.
You'll probably want something to actually be done with the original spams in your inbox. By default nothing happens to them, but you have two options available. If you specify --flag then spams will be flagged.
You can get the messages marked for deletion by specifying --delete. If you never want to see them in your inbox, also specify the --expunge option after --delete and they will be removed when isbg logs out of the IMAP server.
If you have never used SpamAssassin before, you'll probably be quite nervous about it being too good and taking out legitimate email, or not taking out enough spam. It has an easily adustable threshold to change how aggressive it is. Run the following command to create your preferences file ($HOME/.spamassassin/user_prefs):
$ spamassassin </dev/null >/dev/null
Your Folder Names¶
Each IMAP implementation names their folders differently, and most IMAP clients manage to hide most of this from you. If your IMAP server is Courier, then your folders are all below INBOX, and use dots to separate the components.
The UWash server typically has the folders below Mail and uses slash (/) to separate components.
If you don't know how your IMAP folders are implemented, you can always use the --imaplist option to find out.
The full documentation for isbg is maintained in https://isbg.gitlab.io/isbg
- All went well.
- There were errors in the command line arguments.
- The IMAP server reported an error or error with the IMAP connection.
- There was an error of communication between spamc or SpamAssassin.
- The program was not launched in an interactive terminal.
- Error with the lock file, is another instance of isbg must be running.
- Other errors.
With --exitcodes there are also:
- There was at least one new message, and none of them were spam.
- There was at least one new message, and all them were spam.
- There were new messages, with at least one spam and one non-spam.
You can report bugs on https://gitlab.com/isbg/isbg/issues
See the CONTRIBUTORS file in the git repository for more information on who wrote and maintains this software
License GPLv3: GNU GPL version 3 https://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.
|August 17, 2020||2.3.1|