7.1.1.1.1. isbg.__main__ module

isbg scans an IMAP Inbox and runs every entry against SpamAssassin.

See also

isbg for instance creation.

Changed in version 2.0: --partialrun defaults to 50. Use --partialrun=0 to run without partial run.

isbg.__main__.__cmd_opts__()

Isbg scans an IMAP Inbox and runs every entry against SpamAssassin.

Command line Options:

Usage:
 isbg.py --imaphost <hostname> --imapuser <username> [options]
 isbg.py --imaphost <hostname> --imapuser <username> --imaplist [options]
 isbg.py (-h | --help)
 isbg.py --usage
 isbg.py --version

Options:
 --imaphost hostname    IMAP server name.
 --imapuser username    Who you login as.

 --imaplist             List imap directories.

 -h, --help             Show the help screen.
 --usage                Show the usage information.
 --version              Show the version information.

 --dryrun               Do not actually make any changes.
 --delete               The spams will be marked for deletion from
                        your inbox.
 --deletehigherthan #   Delete any spam with a score higher than #.
 --exitcodes            Use exitcodes to detail  what happened.
 --expunge              Cause marked for deletion messages to also be
                        deleted (only useful if --delete is
                        specified).
 --flag                 The spams will be flagged in your inbox.
 --gmail                Delete by copying to '[Gmail]/Trash' folder.
 --ignorelockfile       Don't stop if lock file is present.
 --imappasswd passwd    IMAP account password.
 --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.
 --learnthendestroy     Mark learnt messages for deletion.
 --learnthenflag        Flag learnt messages.
 --learnunflagged       Only learn if unflagged
                        (for  --learnthenflag).
 --learnflagged         Only learn flagged.
 --lockfilegrace=<min>  Set the lifetime of the lock file
                        [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.
 --noninteractive       Prevent interactive requests.
 --noreport             Don't include the SpamAssassin report in the
                        message copied to your spam folder.
 --nostats              Don't print stats.
 --partialrun num       Stop operation after scanning 'num' unseen
                        emails. Use 0 to run without partial run
                        [default: 50].
 --passwdfilename fn    Use a file to supply the password.
 --savepw               Store the password to be used in future runs.
 --spamc                Use spamc instead of standalone SpamAssassin
                        binary.
 --spaminbox mbox       Name of your spam folder
                        [Default: INBOX.Spam].
 --nossl                Don't use SSL to connect to the IMAP server.
 --teachonly            Don't search spam, just learn from folders.
 --trackfile file       Override the trackfile name.
 --verbose              Show IMAP stuff happening.
 --verbose-mails        Show mail bodies (extra-verbose).

 (Your inbox will remain untouched unless you specify --flag or
  --delete)
isbg.__main__.parse_args(sbg)

Argument processing of the command line.

Parameters:

sbg (isbg.ISBG) – the isbg.ISBG instance which would be updated with the parameters.

Returns:

None

Example:

You can run it using:

>>> sbg = isbg.ISBG()
>>> parse_args(sbg)
isbg.__main__.main()

Run when this module is called from the command line.

When the main function ends, it throw a sys.exit with 0 if it has end ok or one of the isbg.isbg.__exitcodes__