This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

An application to label your Gmail messages according to size

Author:Brian Neal <>
Date:May 20, 2012
Home Page:
License:New BSD License (see LICENSE.txt)


weighmail is a program that analyzes your Gmail and applies labels to your messages according to their size. This is useful if you are close to reaching your quota as it allows you to quickly identify large messages. You have complete control over the rules used to create the labels.


weighmail can be installed using Pip:

$ pip install weighmail

Alternatively you can download a tarball and install with:

$ python install

weighmail depends on the IMAPClient library. This library is automatically installed if you use Pip.

Gmail Notes

In case it isn’t clear, weighmail works with Gmail. You must have a Gmail account with IMAP support turned on. Please go into your settings and verify IMAP support is turned on before proceeding.

If you are using two-step verification on your Gmail account (and you really should be), you need to generate an application specific password for weighmail to use. In this case you will use an application specific password instead of your normal password when running weighmail.


weighmail can accept options from a configuration file and/or the command-line. Command-line arguments always take precedence over options found in the configuration file.

Command-Line Arguments

weighmail takes a fair number of arguments on the command-line. Most of these can be omitted however, as they all have sensible defaults. In fact, the simplest way to run weighmail is as follows:

$ weighmail --labels big:1MB-5MB huge:5MB-10MB enormous:10MB-

This example demonstrates:

  • A big label will be applied to messages between 1 and 5 Megabytes
  • A huge label will be applied to messages between 5 and 10 Megabytes
  • An enormous label will be applied to messages 10 MB and bigger
  • Since no user or password options were supplied on the command-line, weighmail will interactively prompt for them. Neither will be echoed out for privacy reasons.

To see a list of all command-line options:

$ weighmail --help

Some notes on the options follows.

  • The --config option is used to specify a configuration file that weighmail will read for options. Any options supplied on the command-line will override any options from this file. In particular, if you specify any label rules on the command-line, all label rules in the configuration file will be ignored.
  • The --folder option can be used to specify which Gmail label to search for messages. This defaults to your All Mail label.
  • The --user and --password options are used to specify which Gmail account to log into. If these are not supplied, and also omitted from a config file (or if no config file is being used), weighmail will prompt you for these options.
  • The --labels argument is how you specify the rules for labeling your messages. See the sub-section below for more detail on this syntax.
  • The --host, --port, and --nossl arguments are for advanced use only, and may in fact not work. The defaults should work for most people, and will connect you to port 993 using SSL.

The –labels argument syntax

To specify label rules on the command-line, use the following syntax:

$ weighmail --labels name:min-max [name:min-max] ...


  • name is the name of the label. Note that Gmail labels cannot have spaces in them.
  • min and max specify the message size range in bytes. Either one, but not both, may be omitted (but the dash must remain). You may use the suffixes KB, MB, or GB to indicate kilobytes, Megabytes, or Gigabytes, respectively.

Another example:

$ weighmail --labels normal:-2MB big:2MB-7MB huge:7MB-

In all these examples the label ranges do not overlap. This does not have to be the case; overlapping ranges may be defined if desired.

Configuration File

If you specify the --config=filename option on the command-line, weighmail will parse this file for options. Please see the included sample-weighmail.ini file for the syntax and option descriptions.

Again, note that command-line arguments take precedence over options found in the configuration file. If you specify any label rules on the command-line, all label rules in the configuration file are ignored.


A big thank-you to Menno Smits, the author of the IMAPClient library. This application would have been considerably more complicated if the awesome IMAPClient library did not exist.

Release History

Release History


This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
weighmail-0.1.0.tar.gz (10.3 kB) Copy SHA256 Checksum SHA256 Source May 21, 2012

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting