# getmail documentation

This is the documentation for getmail version 6, a port of getmail version 5 to python 3 without adding features.

getmail6 is Copyright © 1998-2026 by Charles Cazabon and others:
<charlesc-getmail @ pyropus.ca>
<roland.puntaier @ gmail.com>

getmail and getmail6 are licensed under the GNU General Public License version 2 (only).

# Table of Contents

- getmail documentation
- - getmail documentation
  - - Features
    - Requirements
    - Obtaining getmail
    - Installing getmail
    - - For the impatient
      - Full installation instructions
      - Installing directly from the source
      - - Installing in the default location
        - Installing under an alternate prefix directory
        - Installing parts of the package to alternate directories
      - Installing the getmailcore package in a non-standard location
      - Building a binary package from the source
- getmail configuration (version 6)
- - Configuring getmail
  - - Creating a getmail rc file
  - Running getmail
  - - Commandline options
    - Using getmail as an MDA
    - Using getmail_fetch to retrieve mail from scripts
- getmail troubleshooting
- - Troubleshooting problems
  - - Error messages
    - Warning messages
    - Unexpected Behaviour
- getmail frequently-asked questions (FAQs)
- - Frequently-Asked Questions (FAQs)
  - - About getmail
    - What is getmail6 and how does it relate to getmail?
    - Configuring getmail
    - How do I …
    - Using getmail with other software
    - I think I found this bug in getmail …

## Features

getmail is a mail retriever designed to allow you to get your mail from one or more mail accounts on various mail servers to your local machine for reading with a minimum of fuss. getmail is designed to be secure, flexible, reliable, and easy-to-use. getmail is designed to replace other mail retrievers such as fetchmail.

getmail includes the following features:

- simple to install, configure, and use
- retrieve virtually any mail
  - support for accessing mailboxes with the following protocols:
    - POP3
    - POP3-over-SSL
    - IMAP4
    - IMAP4-over-SSL
    - SDPS (Demon UK's extensions to POP3)
  - support for single-user and domain mailboxes
  - retrieve mail from an unlimited number of mailboxes and servers
  - can remember which mail it has already retrieved, and can be set to only download new messages
- support for message filtering, classification, and annotation by external programs like spam filters and anti-virus programs
- support for delivering messages to different destinations based on the message recipient
- reliability
  - native safe and reliable delivery support for maildirs and mboxrd files, in addition to delivery through arbitrary external message delivery agents (MDAs)
  - does not destroy information by rewriting mail headers
  - does not cause mail loops by doing SMTP injection, and therefore does not require that you run an MTA (like qmail or sendmail) on your host
- written in Python, and therefore easy to extend or customize
  - a flexible, extensible architecture so that support for new mail access protocols, message filtering operations, or destination types can be easily added
  - cross-platform operation; getmail 6 should work on Unix/Linux, Macintosh, and other platforms. Windows support available under the free Cygwin package.
- winner of various software awards, including DaveCentral's "Best of Linux"

## Requirements

getmail version 6 requires Python version 3.7 or later. If you have only an earlier version of Python available, you can install the latest version without disturbing your current version, or use getmail version 5.* from the original getmail author.

getmail 6 requires that servers uniquely identify the messages they provide (via the UIDL command) to getmail for full functionality. Certain very old or broken POP3 servers may not be capable of this or may not implement the UIDL command at all, and limited support is available for such servers via the BrokenUIDLPOP3Retriever and BrokenUIDLPOP3SSLRetriever retriever classes.

## Obtaining getmail

Download getmail 6 from the official website main page at http://getmail6.org/ .

## Installing getmail

### For the impatient

Installing getmail is very easy:

    # sudo pip install getmail6

or

    # pip install --user getmail6

To uninstalling do

    # sudo pip uninstall getmail6

or

    # pip uninstall getmail6

Alternatively download the tarball distribution, unpack it, change into the directory it unpacks into, and run this command:

    # python setup.py install

That's all there is to it. 99.9% of users don't need a special package/port/etc. If you'd like more details on install options, keep reading.

### Full installation instructions

Once you have downloaded or otherwise obtained getmail, unpack it. On GNU-ish Unix-like systems, this means:

    # tar xzf getmail-version.tar.gz

On Macintosh systems, use a Zip-type archiver program to unpack the tarball.

On SystemV-like Unix systems, you may instead need to break this down into two steps:

    # gunzip getmail-version.tar.gz
    # tar xf getmail-version.tar

Then, change into the extracted getmail directory and start the build process. The easiest installation method is to use the included setup.py to build and install getmail directly.

### Installing directly from the source

To build and install directly from the included source, follow these steps.

    # cd getmail-version
    # python setup.py build

When that completes in a few seconds, become root and then install the software. You can install in the default location, or specify an alternate location to install the software, or specify alternate directories for only part of the package.

#### Installing in the default location

To install in the default location, become user root and install with the following commands:

    # su
    enter root password
    # python setup.py install

This will, by default, install files into subdirectories under the directory prefix, which is the directory that your Python installation was configured to install under (typically /usr/local/ or /usr/, but other values are sometimes used):

- the scripts getmail, getmails, getmail_fetch, getmail_maildir, and getmail_mbox will be installed under prefix/bin/
- the Python package getmailcore (which implements all the protocol–, filter–, and destination-specific code for getmail, plus various other bits) will be installed under the site-specific packages directory of your Python library directory. This directory is prefix/lib/python-python-version/site-packages/.
- The documentation directory getmail-getmail-version will be installed under prefix/doc/
- The manual pages for the four scripts will be installed under prefix/man/

You can see a list of the default installation locations by running:

    # python setup.py --show-default-install-dirs

#### Installing under an alternate prefix directory

You can specify an alternate prefix directory by supplying the --prefix option to the install command, like this:

    # python setup.py install --prefix=path

This will install the various parts of the package in subdirectories like in the default installation (see the section Installing in the default location above), but under your specified prefix directory. These alternate installations allow you to install the software without root privileges (say, by installing under $HOME/). Note, however, that the getmailcore package will not be in the default Python module search path if you do this; see the section Installing the getmailcore package in a non-standard location if you use this option.

#### Installing parts of the package to alternate directories

If you only want to change the directory for some of the components, use the following options:

- --install-lib=path specifies the directory the getmailcore package is installed under (i.e., it will be installed as path/getmailcore ). See the section Installing the getmailcore package in a non-standard location if you use this option.
- --install-scripts=path specifies the directory the four scripts are installed under (i.e., they will be installed directly in path/ ).
- --install-data=path specifies the directory the documentation is installed under (i.e., the HTML and plaintext documentation will be installed in the directory path/doc/getmail-getmail-version/, and the man(1) pages will be installed in path/man/man1/.

For example, if your Python installation is located under /usr/ because it was installed as part of your OS, but you would like the getmail scripts installed into /usr/local/bin/ instead of /usr/bin/, while still letting the getmailcore package be installed under /usr/lib/python-python-version/site-packages/, and the documentation and man pages under /usr/doc/ and /usr/man/ you could use this command to install:

    # python setup.py --install-scripts=/usr/local/bin/

If you also wanted to locate the documentation and man pages under /usr/local/ but still install the getmailcore package in the default /usr/lib/python-python-version/site-packages/, you would instead use this command to install:

    # python setup.py --install-scripts=/usr/local/bin/ --install-data=/usr/local/

### Installing the getmailcore package in a non-standard location

Note: if you use one of the above methods to install the getmailcore package into a directory other than the default, the four scripts (getmail, getmails, getmail_fetch, getmail_maildir, and getmail_mbox) will almost certainly be unable to locate the required files from the getmailcore package, because they will not be in a directory in the standard Python module search path. You will need to do one of the following to make those files available to the scripts:

- set the environment variable PYTHONPATH to tell Python where to find the appropriate modules. See the documentation at the Python.org website for details.

  For example, if the directory getmailcore ends up living in $HOME/tmp/getmail/lib/python3.8/site-packages/getmailcore , then in the shell do:

      # export PYTHONPATH=$HOME/tmp/getmail/lib/python3.8/site-packages .

  Note that setting PYTHONPATH in $HOME/.profile (or equivalent) is not sufficient -- for instance, cron runs jobs in a simpler environment, ignoring $HOME/.profile, and getmail would therefore fail when run as a user cron job. It is strongly recommended that you install the Python library files in the site-packages directory which Python provides for exactly this reason.

- modify the scripts to explicitly tell Python where you've installed them. Insert a line like this:

      sys.path.append('/path/to/installation-directory')

  containing the path to the directory you installed the getmailcore directory in, somewhere below the line which reads

      import sys

  and before the first line which references getmailcore .

### Building a binary package from the source

To build a binary package from the included source, run the following command from inside the unpacked getmail source.

    # cd getmail-version
    # python setup.py bdist --format=package-format

The useful allowed values for package-format are:

- rpm — build a .noarch.rpm file which can then be installed with the rpm package manager.
- pkgtool — build a package for the Sun Solaris pkgtool package manager.
- sdux — build a package for the HP/UX swinstall software installer.

Ideally, if you use this method, it will result in a "built distribution" binary package in a subdirectory named dist which can then be installed using the appropriate system-specific tool. If you have problems with this process, please do not ask me for assistance; ask your OS vendor or the comp.lang.python newsgroup. The install-directory-from-source process above is the only one I can support, and it should work on all platforms.