"Fossies" - the Fresh Open Source Software Archive

Member "getmail-5.16/docs/faq.txt" (31 Oct 2021, 47681 Bytes) of package /linux/misc/getmail-5.16.tar.gz:

As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "faq.txt": 5.15_vs_5.16.

    1    Link: Contents Up Index: Charles Cazabon's Software
    3                              getmail documentation
    5    This is the documentation for getmail version 5. Version 5 includes
    6    numerous changes from version 3.x; if you are using getmail version 3,
    7    please refer to the documentation included with that version of the
    8    software.
   10    getmail is Copyright © 1998-2021 Charles Cazabon.
   12    getmail is licensed under the GNU General Public License version 2 (only).
   13    If you wish to obtain a license to distribute getmail under other terms,
   14    please contact me directly.
   16    Note that this license allows you to "fork" getmail. If you do so, please
   17    follow open-source/free-software best practices and rename your fork so
   18    the package name and executable name do not contain the word "getmail" or
   19    anything confusing similar. This helps prevent users mistakenly contacting
   20    the wrong people for help. The fork must also remain under the GPLv2
   21    license, and must preserve all existing copyright notices in the code and
   22    documentation.
   24                        Frequently-Asked Questions (FAQs)
   26    The following questions about getmail are answered more-or-less
   27    frequently. Please also read the unexpected behaviour section of the
   28    troubleshooting document.
   30 About getmail
   32   What is getmail?
   34    getmail is a mail retriever with support for POP3, POP3-over-SSL, IMAP4,
   35    IMAP4-over-SSL, and SDPS mail accounts. It supports normal single-user
   36    mail accounts and multidrop (domain) mailboxes. getmail is written in
   37    Python, and licensed under the GNU General Public License version 2.
   39   What platforms/machines does getmail run on?
   41    getmail runs on basically any platform. It's designed to, and written in a
   42    language that helps to maintain cross-platform compatibility. getmail is
   43    known to run on the following platforms:
   45      * Linux-based GNU systems (all distributions)
   46      * HURD-based GNU systems
   47      * FreeBSD
   48      * OpenBSD
   49      * NetBSD
   50      * HP/UX
   51      * Sun Solaris
   52      * IBM AIX
   53      * Digital/Compaq Tru64 (a.k.a OSF/1) UNIX
   54      * SGI Irix
   55      * other commercial Unices
   56      * Digital VMS / OpenVMS
   57      * BeOS
   58      * Amiga OS
   59      * OS/2
   60      * Cygwin on Windows
   61      * Macintosh OS X
   62      * Macintosh OS 9
   64    But getmail will also run on other, less common platforms. The only real
   65    requirement is that Python run on that platform, and porting Python is
   66    generally very easy.
   68     Does getmail run on MS Windows?
   70    Yes, under the free Cygwin package. Running recent versions of Python
   71    under Cygwin requires a process known as "rebasing" your Cygwin
   72    installation; you can find details in this Python developers' mailing list
   73    message.
   75     Does getmail run on Macintosh systems?
   77    Yes.
   79     Does getmail require Unix/Linux?
   81    No.
   83   How can I get support for getmail?
   85    getmail is Free Software. As such, it comes with no warranty. However, I
   86    will do my best to support getmail on a voluntary basis through the
   87    getmail mailing list.
   89    If you are using getmail in a commercial or other environment where
   90    problems cost money, consider contacting me privately for commercial
   91    support, by emailing <charlesc-getmail-support @ pyropus.ca>
   93    If you have questions about getmail, the first step is to read the
   94    documentation, and the remainder of the Frequently Asked Questions. If
   95    your question isn't answered there, search the getmail mailing list
   96    archives.
   98    If you still haven't found an answer to your question, please subscribe to
   99    the getmail users' mailing list by sending a blank email to
  100    <getmail-subscribe @ lists.pyropus.ca>. If you post your question there, I
  101    will see it. As an additional bonus, your question may be answered by
  102    another member of the list.
  104   I think I found a bug! How do I report it?
  106    First, make sure that you are running the latest version. You can always
  107    find what is the latest version by checking this page at the original web
  108    site:
  109    http://pyropus.ca/software/getmail/.
  110    If you running an older version of the software, chances are whatever bug
  111    you may have found has already been fixed.
  113    Ideally, you should join the mailing list and send your bug report there.
  114    You should include the following information:
  116      * getmail version
  117      * Python version
  118      * any error message which getmail displayed
  119      * the output from running getmail with your normal options plus --dump
  120      * if your problem is getmail not determining the proper local recipient,
  121        please include the output of running getmail with your normal options
  122        plus --trace, showing the retrieval of one problematic message.
  124    If you absolutely cannot sign up for the mailing list, send the report to
  125    me directly at <charlesc-getmail-bugs @ pyropus.ca>. I may not be able to
  126    respond to all reports privately, but I will try to address any bugs I
  127    find out about this way.
  129   I have a neat idea for random feature "foo" … how do I get you to implement
  130   it?
  132    Follow the same instructions as for reporting bugs above — yes, that means
  133    I would prefer you submit your idea to the getmail users' mailing list.
  134    That will lead to a useful discussion if your feature has not been
  135    proposed before.
  137   Why won't you implement random feature "foo"?
  139    Every line of code added to getmail has a certain cost. Every feature
  140    added requires code, documentation, and support. Adding features increases
  141    the complexity of the software, confuses users, and leads to higher
  142    support costs. I therefore weigh features very carefully as a
  143    cost-versus-benefit tradeoff before deciding whether to add them.
  145    Some users are confused by this. They think that a feature you don't use
  146    has no cost, and therefore if it has any value to anyone, it should be
  147    added. That simply isn't the case; the costs of an unused feature are
  148    simply borne by others, including me.
  150    If you have asked me to add some feature, and I've said no, this may be
  151    the reason. Other possibilities include me simply not having had
  152    sufficient time to implement it yet.
  154   Does getmail support virus scanning of retrieved messages?
  156    Yes. You can use getmail message filtering options to do this with an
  157    external virus scanning program, or invoke your virus scanning program
  158    during delivery with getmail's support for external MDAs.
  160    Also see the FAQ about using getmail with the ClamAV program.
  162   Does getmail support spam filtering of retrieved messages?
  164    Yes. You can use getmail message filtering options to do this with an
  165    external spam filtering program, or invoke your spam filtering program
  166    during delivery with getmail's support for external MDAs.
  168    Also see the FAQ about using getmail with the SpamAssassin program.
  170   Does getmail support SSL?
  172    Yes. getmail has built in support for POP3-over-SSL and IMAP4-over-SSL.
  174   Does getmail rewrite mail headers when it retrieves mail?
  176    No. Rewriting message header fields is bad for many reasons; the biggest
  177    problem is that it causes a loss of critical technical information
  178    necessary to track down many mail problems. getmail will add a new
  179    Received: header field and a new Delivered-To: header field, but does not
  180    rewrite existing headers. You can disable the creation of these header
  181    fields.
  183   What are these oldmail* files? Can I delete or trim them?
  185    getmail stores its state - its "memory" of what it has seen in your
  186    POP/IMAP account - in the oldmail files.
  188    Do NOT delete or edit these files. You'll make getmail re-retrieve all
  189    your old mail, or even prevent getmail from running. The files are tiny by
  190    modern storage standards; you could have a million of these files and
  191    still not have to worry about the disk space they take up for a thousand
  192    years.
  194   Can I upgrade from getmail 3 to getmail 4/5? What about my "oldmail" files?
  196    Yes. getmail version 4/5 uses exactly the same
  197    oldmail-server-port-username naming convention for its oldmail files. The
  198    only difference is that version 4/5 escapes a couple of additional
  199    characters in this string so that it is truly cross-platform compatible.
  200    If you upgrade from version 3 to version 4/5, getmail will still remember
  201    which messages you've already retrieved.
  203    To upgrade, do the following:
  205     1. Rename your old getmail rc file, creating a new file in
  206        ~/.getmail/getmailrc.
  207     2. Create a new [options] section, containing the appropriate values from
  208        your version 3 rc file [defaults] section.
  209     3. Create a new [retriever] section, using your previous server
  210        configuration values in a new type = SimplePOP3Retriever or type =
  211        MultidropPOP3Retriever as appropriate.
  212     4. Create a new [destination] section, using your previous destination
  213        path values in a new type = Maildir, type = Mboxrd, type =
  214        MDA_external, or type = MultiSorter destination as appropriate.
  215     5. If you were retrieving messages from multiple mail accounts in a
  216        single version 3 getmail rc file, split them up into one account per
  217        version 5 rc file.
  219    That's it.
  221   Why did you write getmail? Why not just use fetchmail?
  223    Short answer: … well, the short answer is mostly unprintable. The long
  224    answer is … well, long:
  226    I do not like some of the design choices which were made with fetchmail.
  227    getmail does things a little differently, and for my purposes, better. In
  228    addition, most people find getmail easier to configure and use than
  229    fetchmail. Perhaps most importantly, getmail goes to great lengths to
  230    ensure that mail is never lost, while fetchmail (in its default
  231    configuration) frequently loses mail, causes mail loops, bounces
  232    legitimate messages, and causes many other problems.
  234    When people have pointed out problems in fetchmail's design and
  235    implementation, it's maintainer has frequently ignored them, or (worse
  236    yet) gone in the completely wrong direction in the name of "fixing" the
  237    problems. For instance, fetchmail's configuration file syntax has been
  238    criticized as being needlessly difficult to write; instead of cleaning up
  239    the syntax, the maintainer instead included a GUI
  240    configuration-file-writing program, leading to comments like:
  242      The punchline is that fetchmail sucks, even if it does have
  243      giddily-engineered whizbang configurator apps.
  245    As an example, Dan Bernstein, author of qmail and other software packages,
  246    once noted to the qmail list:
  248      Last night, root@xxxxxxxxxxxxxxxxx reinjected thirty old messages from
  249      various authors to qmail@xxxxxxxxxxxxxx
  251      This sort of idiocy happens much more often than most subscribers know,
  252      thanks to a broken piece of software by Eric Raymond called fetchmail.
  253      Fortunately, qmail and ezmlm have loop-prevention mechanisms that stop
  254      these messages before they are distributed to subscribers. The messages
  255      end up bouncing to the wrong place, thanks to another fetchmail bug, but
  256      at least the mailing list is protected.
  258      --D. J. Bernstein
  260    The maintainer also ignored dozens of complaints about fetchmail's
  261    behaviour, stating (by fiat) that fetchmail was bug-free and had entered
  262    "maintenance mode", allowing him to ignore further bug reports.
  264    fetchmail's default configuration values frequently cause lost or
  265    misdirected mail, and seem to be chosen to cause maximum pain and
  266    inconvenience. From fetchmail's to-do file (emphasis mine):
  268      Maybe refuse multidrop configuration unless "envelope" is _explicitly_
  269      configured … This would prevent a significant class of
  270      shoot-self-in-foot problems.
  272      perhaps treat a delivery as "temporarily failed" … This is so you don't
  273      lose mail if you configure the wrong envelope header.
  275    fetchmail is famous for mangling messages it retrieves, rather than
  276    leaving them alone as a mail-handling program should. getmail will add
  277    trace information to messages (so you can see what happened, and when),
  278    but will otherwise leave message content alone.
  280    In addition, fetchmail has a long history of security problems:
  282      * versions released before 20 June 2001 contain a buffer overflow, which
  283        can be remotely exploited (see www.securityfocus.com/bid/2877 for
  284        details). getmail is not vulnerable to buffer overflows, because
  285        buffers in Python are dynamically sized.
  286      * Another remotely-exploitable security hole discovered in fetchmail in
  287        June 2002; versions prior to 5.9.10 (released in June 2002) are
  288        exploitable .
  289      * Reading fetchmail's UPDATES file, it appears that another security
  290        problem was fixed in 5.9.12, where a server could crash fetchmail on
  291        64-bit platforms. Also worrying is a mention that it includes a fix
  292        for "password shrouding".
  293      * Another remotely-exploitable security hole in fetchmail discovered in
  294        September 2002; this hole lets an attacker run arbitrary code on the
  295        victim's computer.
  296      * Another remotely-exploitable security hole in fetchmail discovered in
  297        December 2002; once again, a remote attacker can run arbitrary code on
  298        the machine running fetchmail in its default configuration. See this
  299        advisory for details.
  300      * January 2003: More buffer overflows in fetchmail let attackers run
  301        arbitrary code .
  302      * October 2003: Anyone can cause fetchmail to crash by sending you a
  303        message . Other problems are here , and I might have missed some .
  304      * Just in case you thought fetchmail was all better now, there's still
  305        new security problems being discovered in it. In December, 2005, it
  306        was revealed that anyone can send a fetchmail multidrop user a message
  307        that causes fetchmail to crash.
  309    In July, 2004, it was noted that there may be at least 2 unfixed
  310    denial-of-service attacks, 2 unfixed remote-code-execution, 2 unfixed
  311    remote-user-access, and 3 unfixed remote-shell attacks against fetchmail.
  312    See http://www.mail-archive.com/euglug@euglug.org/msg00971.html for
  313    details
  315    I've given up even trying to stay abreast of the various security holes in
  316    fetchmail, but others have noted continuing problems, including:
  318      * another arbitrary code execution vulnerability announced on 21 July
  319        2005.
  321    The fetchmail authors' boneheaded decision to create a configuration-file
  322    GUI editor (rather than actually giving fetchmail a sane configuration
  323    syntax) also came back to bite them in the ass: in October 2005, it became
  324    known that fetchmailconf created its files in such a way that users'
  325    passwords could be read during file creation.
  327    Addendum, January 2007: since I wrote the above, the following new
  328    security problems have been discovered in fetchmail:
  330      * CVE-2005-4348 - anyone can crash fetchmail by sending messages without
  331        headers
  332      * CVE-2006-0321 - anyone can crash fetchmail by sending a message that
  333        fetchmail tries to bounce
  334      * CVE-2006-5867 - fetchmail can transmit passwords in plaintext even if
  335        the user has configured it not to
  336      * CVE-2006-5974 - anyone can cause fetchmail to crash by triggering
  337        certain error code paths
  339    But don't just take my word for it; see
  340    http://docs.freebsd.org/cgi/mid.cgi?200102172349.QAA11724 and
  341    http://esr.1accesshost.com/ (note: went offline sometime in 2009 or 2010;
  342    the content is still available at
  343    http://web.archive.org/web/20080621090439/http://esr.1accesshost.com/ ).
  345    getmail users have not had to worry about any of these security holes or
  346    design and implementation errors.
  348 Configuring getmail
  350   What is a "domain mailbox"?
  352    A domain (or multidrop) mailbox is a POP3 mailbox which receives mail for
  353    all users in a given domain. Normal mailboxes contain mail for a single
  354    user (like jason@myisp.co.uk); some Internet Service Providers which
  355    provide webhosting or other services will provide a POP3 mailbox which
  356    receives mail for all addresses in a given domain (i.e. mail for
  357    service@smallcompany.net, sales@smallcompany.net, and indeed anything
  358    @smallcompany.net ends up in the same POP3 mailbox).
  360    getmail provides a method of retrieving mail from a domain mailbox and
  361    distributing it among the various users automatically. The retriever
  362    classes MultidropPOP3Retriever, MultidropPOP3SSLRetriever,
  363    MultidropSDPSRetriever, MultidropIMAPRetriever, and
  364    MultidropIMAPSSLRetriever provide this capability.
  366    See the documentation on the [retriever] section for details of what the
  367    requirements for a multidrop mailbox are. getmail user Matthias Andree
  368    also has a web page about multidrop mailboxes.
  370   Do I have to run sendmail or another MTA to use getmail?
  372    No. getmail delivers directly to maildirs, mboxrd files, or via arbitrary
  373    MDAs, and never injects mail via SMTP, so no MTA is necessary.
  375   Will getmail deliver mail as root?
  377    No. When run as the root user on a Unix-like system, getmail drops
  378    privileges (switches to an unprivileged group and user id) before
  379    delivering to maildirs or mboxrd files. You can specify the user
  380    explicitly, or let getmail use the owner of the maildir or mboxrd file.
  382    If getmail attempts to deliver mail and finds it has UID 0 or GID 0, it
  383    will refuse the delivery and print an error message.
  385   What's a maildir?
  387    A maildir is a mail storage format invented by D. J. Bernstein (author of
  388    qmail) that requires no file locking to deliver to safely and reliably,
  389    even over NFS. getmail natively supports delivery to maildirs.
  391    See http://qmail.org/man/man5/maildir.html and
  392    http://cr.yp.to/proto/maildir.html for details.
  394   What's "mboxrd" format?
  396    There are various sub-types of the mbox mail storage format. mboxrd is the
  397    most reliable of them, though (like all mbox types) it still relies on
  398    file locking and is therefore more easily corrupted than maildir format.
  399    In particular, using mbox files with multiple writers over NFS can be
  400    problematic.
  402    For details on the differences between the various mbox sub-types, see
  403    http://qmail.org/man/man5/mbox.html.
  405   What's this "envelope sender" and "envelope recipient" stuff?
  407    The "envelope" of an email message is "message metadata"; that is, the
  408    message is information, and the envelope is information about the message
  409    (information about other information). Knowing this is critical to
  410    understanding what a domain or multidrop mailbox is, how it works, and
  411    what getmail can do for you.
  413    Others have tried to explain this with varying degrees of success. I'll
  414    use the standard analogy of normal postal (i.e. non-electronic) mail:
  416     Message header vs. message envelope
  418    When you receive a letter (a reply from the customer-disservice department
  419    of your telephone company, say) it arrives in an envelope. You tear it
  420    open, remove the letter, and read it. At the top of the letter is the
  421    telephone company's return address, followed by the date the letter was
  422    written. Your name and mailing address follow that, and then the remainder
  423    of the letter.
  425    The important thing to keep in mind is that the contents of the letter
  426    (including the addresses just discussed) are never looked at by the post
  427    office. If they can't deliver the letter (your mailing address on the
  428    envelope got smudged in the rain), they'll return it to the address listed
  429    in the top-left corner of the envelope. They don't check to make sure that
  430    the address listed there is the same as the one listed at the top of the
  431    letter. Similarly, when they can successfully deliver it, they don't check
  432    to make sure that the recipient name and address on the envelope matches
  433    the one listed on the letter between the date and the salutation.
  435    The message header fields From: and Resent-from: are equivalent to the
  436    block of address information at the top of the letter; it usually contains
  437    the name and address of the sender of the message, but it is never
  438    actually used in the delivery of the message. Similarly, the To:, cc:,
  439    Resent-to:, and Resent-cc: header fields are the equivalent of the block
  440    of address information between the date and the salutation on the letter;
  441    they usually contain the names and addresses of the intended recipients of
  442    the message, but they too are not used in the delivery of the message.
  444     Receiving messages without your address in the message header
  446    You might open an envelope addressed to you and find that the letter
  447    inside makes no mention of your name. Your name and address don't appear
  448    anywhere in the letter, but it was still successfully delivered to you
  449    based on the envelope information. There's nothing strange about this. If
  450    someone else opens your mail for you, discards the envelopes, and places
  451    the contents in your in-basket, you might wonder how some of it ended up
  452    there, because there's nothing to connect you with the message contents.
  454    Email is exactly like this. Each message has two parts, the message
  455    contents, and the message envelope. The message contents include the
  456    message header, and the message body. The message envelope is made up of
  457    exactly one envelope sender address (which can be empty) and one or more
  458    envelope recipient addresses. If the message cannot be delivered for any
  459    reason, and the envelope sender address is not empty, the message must be
  460    returned to the envelope sender address by the mail transfer agent (MTA)
  461    which last accepted responsibility for delivering the message. These
  462    notifications are known as "bounce messages" or sometimes as "non-delivery
  463    notifications". Bounce messages are sent using the empty envelope return
  464    path, to prevent mail loops from occurring when a bounce message itself
  465    cannot be delivered.
  467    Confusion often arises among novice users about the difference between the
  468    message header and the message envelope; they seem to believe that they
  469    are not independant. This appears to be an artifact of their use of
  470    simple-minded GUI mail user agents (MUAs) that do not allow them to set
  471    the envelopes of their messages explicitly, but instead simply use the
  472    contents of the From: header field as the envelope sender address, and any
  473    addresses found in To:, cc:, and bcc: header fields as the envelope
  474    recipient addresses. While these are sensible as default values, more
  475    powerful MUAs allow the user to override this choice.
  477     Responsibility for recording the message envelope
  479    The last MTA to receive a message (usually the one running on the POP or
  480    IMAP server where you retrieve your mail from) essentially acts as your
  481    correspondence secretary, accepting your mail from the postman, opening
  482    it, and placing it into your in-basket. Note that this would normally
  483    destroy the important information contained in the message envelope. To
  484    prevent this loss of information, this MTA is supposed to copy the
  485    information from the envelope into new fields in the header of the message
  486    content, as if your secretrary copied the sender and recipient addresses
  487    onto the back of your letters in felt pen. Unfortunately, some MTAs do not
  488    always do this properly, and envelope information can then be lost. When
  489    this happens, it makes dealing with certain types of mail messages
  490    problematic:
  492      * bcc'd messages (bcc stands for blind carbon copy), where you are an
  493        envelope recipient, but your address does not appear in the message
  494        content (i.e., your address does not appear in a To:, cc:, or similar
  495        message header field). With bcc'd messages, the From: header field
  496        contains the name and address of the author of the message, and the
  497        To: and cc: header fields contain the names and addresses of the
  498        other, non-blind recipients of the message.
  499      * mailing list messages, where you are an envelope recipient, but your
  500        address does not appear in the message content (i.e., your address
  501        does not appear in a To:, cc:, or similar message header field).
  502        Mailing list messages have the envelope sender address set to the
  503        mailing list manager (so that it can monitor "bad" list addresses for
  504        bounces), while the From: header field contains the name and address
  505        of the author of the message. The envelope recipient addresses of
  506        mailing list messages are the addresses of the list subscribers, while
  507        the To: header field usually contains the address of the mailing list.
  508      * other, less common cases.
  510    MTAs are supposed to record the envelope sender address by placing it into
  511    a new Return-Path: header field at the top of the message. They should
  512    then record the envelope recipient address(es) in another new header
  513    field; sometimes this header field is named Delivered-To:, but it can also
  514    be Envelope-To: or one of a few other names.
  516     How this relates to domain or multidrop mailboxes
  518    A domain or multidrop mailbox is one which receives mail for multiple
  519    email addresses (commonly all addresses in a given domain). If you do not
  520    want all of this mail to go to one person, you need to know who the
  521    messages were originally addressed to after retrieving them from the
  522    POP/IMAP multidrop mailbox. You cannot do this by looking at the To:, cc:,
  523    or other informational message header fields, because they do not actually
  524    reflect the message envelope at the time of delivery. Instead, you have to
  525    reconstruct the envelope information from the message header fields which
  526    the MTA on the server used to record it at the time of delivery.
  528    If the final MTA does not record the message envelope (the envelope
  529    sender, and all envelope recipient addresses in the domain mailbox the
  530    message was sent to), then mail will be lost or misdirected regardless of
  531    which software you use to access the mailbox. The mailbox cannot actually
  532    be said to be a domain mailbox in this case; the defining characteristic
  533    of a domain mailbox is that it records the envelope correctly. The
  534    configuration of the MTA running on the server needs to be fixed so that
  535    the envelope is properly recorded for every message it receives.
  537   This rc stuff seems complicated. Does it have to be?
  539    The configuration file format is actually very simple; you don't need to
  540    worry about most of it if you're not interested in using those features.
  541    The simplest and most common getmail rc file configuration will be for
  542    users who want to retrieve all mail from a single-user POP3 mailbox,
  543    deliver those messages to a maildir or mbox file, and delete the mail from
  544    the server. For maildir, that configuration is:
  546  [options]
  547  delete = True
  549  [retriever]
  550  type = SimplePOP3Retriever
  551  server = my-pop3-servername
  552  username = my-pop3-username
  553  password = my-pop3-password
  555  [destination]
  556  type = Maildir
  557  path = ~/Maildir/
  559    For an mbox file, that configuration is:
  561  [options]
  562  delete = True
  564  [retriever]
  565  type = SimplePOP3Retriever
  566  server = my-pop3-servername
  567  username = my-pop3-username
  568  password = my-pop3-password
  570  [destination]
  571  type = Mboxrd
  572  path = ~/inbox
  574 How do I …
  576   How do I retrieve mail from multiple accounts?
  578    Create a separate getmail rc file for each account, and run getmail with
  579    multiple --rcfile options.
  581    Of course, it's really easy to script this for a large number of rc-*
  582    files. You might create a script in $HOME/bin/run-getmail.sh containing:
  584  #!/bin/sh
  585  set -e
  586  cd /path/to/my-rc-directory
  587  rcfiles=""
  588  for file in rc-* ; do
  589    rcfiles="$rcfiles --rcfile $file"
  590  done
  591  exec /path/to/getmail $rcfiles $@
  593    See any beginner's tutorial on Unix shell scripting for details.
  595   How do I get getmail to deliver messages to different mailboxes based on …
  597    If you want getmail to sort messages based on who they're from, or what
  598    address appears in the To: or cc: header fields, or based on the Subject:
  599    field contents, or anything like that, pick a filtering MDA (like maildrop
  600    or procmail), and call it from a getmail MDA_external destination.
  602   How do I stop getmail adding a Delivered-To: header to messages?
  604    Use the delivered_to [options] parameter.
  606   How do I stop getmail adding a Received: header to messages?
  608    Use the received [options] parameter.
  610   How do I make getmail deliver messages by re-injecting with SMTP?
  612    You don't need to. getmail can deliver to maildirs, mboxrd files, or
  613    through arbitrary external MDAs.
  615    If you still think you need to, you can use getmail's external MDA support
  616    to do so.
  618   How do I create a maildir?
  620    Use the maildirmake command, if you have it installed. Otherwise, run the
  621    following command from your shell:
  623  $ mkdir -p /path/to/Maildir/{cur,new,tmp}
  625    Some other maildir-aware programs ship with their own maildir-creation
  626    programs; you can use those, or make the above shell command a shellscript
  627    or alias if you like.
  629   How do I create an mboxrd file?
  631    Create a completely empty (i.e. zero bytes long) file via your favourite
  632    method. The standard utility touch is commonly used:
  634  $ touch /path/to/mboxrd
  636   How do I make getmail deliver messages to an mh folder?
  638    mh clients (and nmh, or "new mh" clients) include a command for delivering
  639    a message into your mh folder. In nmh, this command is called rcvstore.
  640    You use it as an external message delivery agent (MDA) with getmail's
  641    MDA_external destination. Ensure your $HOME/.mh_profile file is configured
  642    properly; getmail user Frankye Fattarelli suggests a line like the
  643    following is necessary to indicate the path to your mh mail root:
  645  Path: Mail
  647    Then use MDA_external like this (which, after adjusting the path of the
  648    command to reflect your mh/nmh installation, should work with either mh or
  649    nmh):
  651  [destination]
  652  type = MDA_external
  653  path = /usr/local/libexec/nmh/rcvstore
  654  arguments = ("+inbox", )
  656    Thanks to Frankye Fattarelli for contributing this answer.
  658   How do I run getmail in "daemon" mode?
  660    getmail does not have, and does not need, any special "daemon mode". You
  661    just run getmail under whatever process-supervision or periodic-job system
  662    you already have on your system.
  664    For example, if you use daemontools/svscan/supervise, you can configure a
  665    getmail "service" using a simple run script like:
  667  #!/bin/sh
  669  /path/to/getmail [options]
  670  sleep 1800
  672    That example would run getmail continuously, sleeping for 30 minutes
  673    between runs. You can probably work out similar scripts for other
  674    process-supervision systems.
  676    If you don't have such a system, you can use your system's cron utility to
  677    run getmail periodically, but you absolutely have to prevent multiple
  678    copies of getmail from being run by cron simultaneously. Most versions of
  679    cron have no protection for this built-in, so you have to use setlock or
  680    flock or a similar utility to prevent it. For more details, see How do I
  681    stop multiple instances of getmail from running at the same time? below.
  682    If you do not prevent multiple copies of getmail running against the same
  683    server (and IMAP folder) simultaneously, you will get odd behaviour,
  684    including retrieving the same messages multiple times.
  686   How do I make getmail stop after retrieving X messages so that the server
  687   actually flushes deleted messages?
  689    Use the max_messages_per_session option to limit the number of messages
  690    getmail will process in a single session. Some users with flaky servers
  691    use this option to reduce the chances of seeing messages more than once if
  692    the server dies in mid-session.
  694   How do I make getmail retrieve mail from Hotmail?
  696    Well, you could write a retriever that speaks Hotmail's proprietary,
  697    undocumented, and unsupported access protocol (or pay me to write one), or
  698    simply set up the POP3 proxy from the httpmail package, and have getmail
  699    retrieve mail from that POP3 proxy.
  701   I'm using getmail. How do I make it …
  703    These are supplementary questions I occasionally see about doing various
  704    things to enhance a getmail setup. The solution to many of them is to use
  705    a standard Unix technique of some sort to make the system behave in a
  706    certain manner, or otherwise change the behaviour of something that's
  707    actually outside of getmail proper.
  709     I'm running getmail from cron. How do I temporarily stop it?
  711    Some people ask about temporarily stopping getmail from running from a
  712    cron job, possibly because the mail server is down and they don't want to
  713    see the warnings cron mails them.
  715    The easiest method is to comment out getmail from your crontab file:
  717     1. Run
  719  $ crontab -e
  721        to edit your crontab file.
  722     2. Place a # (pound) character at the start of the line containing the
  723        call to getmail.
  724     3. Save the changed file.
  726    When you want to re-enable getmail, edit the file again and un-do the
  727    above change.
  729    If you need to do this on a regular basis, you can instead use a "flag
  730    file" to tell the system whether or not to run getmail:
  732    Change your cron job or shellscript that normally launches getmail to
  733    check for the presence of a certain file first, and have it not run
  734    getmail if that file is present. For example, your crontab entry could be
  735    changed to do this:
  737      [ -f ~/.getmail/do-not-run ] || /path/to/getmail
  739    When you don't want getmail to run, touch that file:
  741      $ touch ~/.getmail/do-not-run
  743    When you want getmail to run again, delete it:
  745      $ rm -f ~/.getmail/do-not-run
  747    This is even safe for scripting, as creating and removing the file are
  748    atomic operations under Unix.
  750     How do I stop multiple instances of getmail from running at the same time?
  752    getmail has no problems running multiple instances in parallel, though you
  753    shouldn't attempt to use the same getmail rc file from two different
  754    instances at the same time; it will probably cause getmail to deliver
  755    duplicate copies of messages, "forget" that it has seen particular
  756    messages before, and other similar problems.
  758    In particular, if you're running getmail from a crontab, you must do
  759    something to prevent cron from starting getmail if the previous invocation
  760    is still running.
  762    If you need to prevent two instances of getmail from running
  763    simultaneously, use any standard Unix method of providing a mutex for this
  764    purpose. One example would be to run getmail under a program like setlock
  765    (part of the daemontools package). Change your script or crontab file to
  766    invoke getmail like this:
  768  /path/to/setlock -n /path/to/lockfile /path/to/getmail [getmail options]
  770    There are other programs that provide functionality similar to setlock.
  772 Using getmail with other software
  774    getmail user Frankye Fattarelli contributed to the following questions
  775    about integrating getmail with SpamAssassin and ClamAV.
  777   How do I use SpamAssassin with getmail?
  779    SpamAssassin can be run in standalone mode or in a client/server
  780    configuration. In both configurations, SpamAssassin accepts a wide variety
  781    of arguments; please refer to SpamAssassin's manual pages or online
  782    documentation for details.
  784    To filter messages through SpamAssassin in a client/server configuration
  785    (i.e. with the spamd daemon), use a configuration like this:
  787  [filter]
  788  type = Filter_external
  789  path = /usr/local/bin/spamc
  790  arguments = ("-s", "10000")
  792    The value supplied to the -s option is the maximum message size accepted
  793    (in bytes). The default is 250k.
  795    A similar configuration without the spamd daemon would be:
  797  [filter]
  798  type = Filter_external
  799  path = /usr/local/bin/spamassassin
  800  arguments = ("--report", )
  802    The --report option sends the message to the various spam-blocker
  803    databases and tags it as spam in your bayesian database.
  805    Note that if you are using Bayesian (learning) filtering, and you've put
  806    your SpamAssassin filter after any getmail Filter_classifier, you may have
  807    a problem with your learning filter learning getmail's header fields. That
  808    is, the headers added by the other filters may get learned, and affect
  809    your database. To prevent this, ensure that SpamAssassin ignores these
  810    fields by adding the following to your SpamAssassin configuration:
  812  bayes_ignore_header X-getmail-filter-classifier
  814   How do I use ClamAV with getmail?
  816    You should also read this message in the getmail users' mailing list
  817    archives and the ClamAV documentation if you want to use ClamAV with
  818    getmail.
  820    ClamAV, like SpamAssassin, can by used in standalone or client/server
  821    configurations. In either case, you need to add the StreamSaveToDisk
  822    option to your clamav.conf file to enable scanning from stdin.
  824    To use ClamAV without the clamd daemon, use a filter configuration like
  825    this:
  827  [filter]
  828  type = Filter_classifier
  829  path = /usr/local/bin/clamscan
  830  arguments = ("--stdout", "--no-summary",
  831      "--mbox", "--infected", "-")
  832  exitcodes_drop = (1,)
  834    The above assumes you do not want the infected emails to be delivered. If
  835    you do want them delivered, you would use a slightly different
  836    configuration:
  838  [filter]
  839  type = Filter_classifier
  840  path = /usr/local/bin/clamscan
  841  arguments = ("--stdout", "--no-summary",
  842      "--mbox", "--infected", "-")
  843  exitcodes_keep = (0,1)
  845    To use ClamAV with the clamd daemon, use a filter configuration like this:
  847  [filter]
  848  type = Filter_classifier
  849  path = /usr/local/bin/clamdscan
  850  arguments = ("--stdout", "--disable-summary", "-")
  851  exitcodes_drop = (1, )
  853    As with Clamscan (above), if you do want the infected messages delivered
  854    instead of dropped, you should modify your configuration as follows:
  856  [filter]
  857  type = Filter_classifier
  858  path = /usr/local/bin/clamdscan
  859  arguments = ("--stdout", "--disable-summary", "-")
  860  exitcodes_keep = (0,1)
  862    You may find it necessary to specify the paths of some decompression
  863    utilities used by ClamAV with additional arguments like:
  865  arguments = ( …,
  866      "--unzip=/usr/local/bin/unzip",
  867      "--unrar=/usr/local/bin/unrar",
  868      "--unarj=/usr/local/bin/unarj",
  869      "--lha=/usr/local/bin/lha",
  870      "--jar=/usr/local/bin/unzip",
  871      "--tar=/usr/bin/tar",
  872      "--tgz=/usr/bin/tar"
  874    Note: if you want to use the daemonized (client/server) version of ClamAV,
  875    ensure that your clamav.conf file contains:
  877  ScanMail
  879    The paths to the various decompression utilities must be specified in this
  880    file as well.
  882    See the following mailing list message from Frankye Fattarelli for
  883    additional notes on using ClamAV with getmail:
  884    https://marc.info/?l=getmail&m=109128345509273&w=2
  886     Getting prettier output from ClamAV
  888    Using getmail's Filter_classifier, the output of your filtering program
  889    (in this case ClamAV) is placed into a X-getmail-filter-classifier: header
  890    field in the message. This can make auditing the actions of filters
  891    difficult if you use multiple filters and cannot tell which filter added
  892    which line.
  894    To correct this, you can use an additional filter to change the name of
  895    the added filter header lines immediately after each filter is run. For
  896    example, reformail, from the maildrop package (which is in turn part of
  897    the Courier MTA ) can be used in this fashion to rename the added header
  898    fields (say, to "X-mypersonalmailscan") with a filter configuration like
  899    this:
  901  type = Filter_external
  902  path = /usr/local/bin/reformail
  903  arguments = ("-R", "X-getmail-filter-classifier:",
  904      "X-mypersonalmailscan:")
  906    Simply ensure ClamAV is invoked as the first filter, and this is invoked
  907    as the second filter (or immediately after the ClamAV filter, if it is the
  908    second, third, etc. filter).
  910   How do I use F-Prot with getmail?
  912    getmail user Kai Raven reports that getmail and F-Prot work fine together
  913    with the following getmailrc filter configuration:
  915  [filter]
  916  type = Filter_external
  917  path = /usr/local/bin/f-prot-wrapper.sh
  919    The wrapper script f-prot-wrapper.sh is a small shellscript by Ali Onur
  920    Cinar, and can be downloaded from his website.
  922   How do I use procmail with getmail?
  924    Simply invoke procmail as an external MDA. procmail requires that one of
  925    the following be true:
  927      * that the message begin with a Unix "From " line (the mbox message
  928        delimiter)
  929      * that procmail is invoked with the -f option supplying the envelope
  930        sender, so that it may generate the "From " line
  932    To have getmail generate and prepend the "From " line to the start of the
  933    message, set the MDA_external parameter unixfrom to True:
  935  [destination]
  936  type = MDA_external
  937  path = /path/to/procmail
  938  unixfrom = True
  940    To supply the -f option to procmail, do something like this:
  942  [destination]
  943  type = MDA_external
  944  path = /path/to/procmail
  945  arguments = ("-f", "%(sender)")
  947   How do I use maildrop with getmail?
  949    Simply invoke maildrop as an external MDA. maildrop requires that the
  950    message begin with a Unix "From " line (the mbox message delimiter), so
  951    you'll need to either set the MDA_external parameter unixfrom to True, or
  952    supply arguments that tell maildrop to recreate this line. One of the
  953    following would be fine:
  955  [destination]
  956  type = MDA_external
  957  path = /path/to/maildrop
  958  arguments = ("-f", "%(sender)")
  960    Or:
  962  [destination]
  963  type = MDA_external
  964  path = /path/to/maildrop
  965  unixfrom = True
  967    If you want to specify a maildrop rc file as one of its arguments, that
  968    would be something like:
  970  [destination]
  971  type = MDA_external
  972  path = /path/to/maildrop
  973  arguments = ("-f", "%(sender)", "~/.maildroprc")
  975   How do I use TMDA with getmail?
  977    Simply use the Filter_TMDA module as a message filter:
  979  [filter-X]
  980  type = Filter_TMDA
  982    See the documentation for details on optional parameters to the
  983    Filter_TMDA module.
  985     How can I get Gmail labels with getmail?
  987    As of getmail version 4.34.0, getmail retrieves the labels and other
  988    metadata that Gmail makes available via an IMAP extension, and records
  989    that information in the message headers X-GMAIL-LABELS:, X-GMAIL-THRID:,
  990    and X-GMAIL-MSGID:.
  992 I think I found this bug in getmail …
  994    I get frequent reports like the following, which aren't bugs in getmail.
  995    Please read them before reporting them to me.
  997   getmail doesn't download all my mail from Gmail …
  999    There's a couple of different problems here. One is that Google's Gmail
 1000    service violates the POP3 protocol by removing messages from the POP3 view
 1001    of the mailbox without the user issuing a DELE command. They do this as
 1002    soon as an RETR command is given, so if getmail tries to download a
 1003    message and it fails for any reason (delivery fails due to a full disk, or
 1004    the Gmail server fails to respond, or the network connection dies before
 1005    the transfer is complete, or the Gmail server fails to respond to the QUIT
 1006    command, or …), the next time getmail connects to that Gmail account,
 1007    Gmail will have "helpfully" deleted the message from the POP3 mailbox,
 1008    even though getmail never issued a DELE command. So Gmail silently
 1009    destroys mail, from a POP3 perspective. There's nothing getmail can do
 1010    about this.
 1012    Note this feature of Gmail is not well-publicized. The only mention I can
 1013    find of it is here:
 1014    http://mail.google.com/support/bin/answer.py?answer=13291&topic=1555
 1016    The other issue here is that Google doesn't include mail from your trash
 1017    or spam folders in the POP3 view, so getmail can't see those messages
 1018    either. That's generally less of an issue, provided their spam filters
 1019    never give false positive results (ha!).
 1021   FutureWarning: %u/%o/%x/%X of negative int will return a signed string in
 1022   Python 2.4 and up
 1024    Various people have reported this "bug" in getmail, where they see the
 1025    following warning when getmail is run:
 1027  /usr/lib/python2.3/optparse.py:668: FutureWarning: %u/%o/%x/%X of negative int will return a signed string in Python 2.4 and up
 1028    return ("<%s at 0x%x: %r>"
 1030    This warning is a bug in Python 2.3.4's optparse.py module, not in
 1031    getmail. Feel free to report it to the Python team if the most recent
 1032    release of Python hasn't fixed it. I reported it in June, 2004.
 1034   AttributeError: 'module' object has no attribute 'fsync'
 1036    Various people have reported this "bug" in getmail — it's actually a bug
 1037    in some versions of Python 2.3.X. It was fixed in Python version 2.3.3.
 1038    getmail 5 detects problematic versions of Python and refuses to run, but
 1039    you can still encounter this problem with getmail version 3 if you try to
 1040    run it with a broken Python version.
 1042   operation error (SimplePOP3Retriever: [...] does not uniquely identify
 1043   messages [...] see documentation or use BrokenUIDLPOP3Retriever instead
 1045    The server you're trying to use does not properly uniquely identify
 1046    messages (getmail noticed when it saw the same "unique" identifier twice
 1047    in the same mailbox at the same time). getmail needs these identifiers to
 1048    be unique so that it can properly tell the difference between new and old
 1049    messages.
 1051    If you see this error message, and you've configured getmail to retrieve
 1052    and immediately delete all messages, just switch to using the
 1053    BrokenUIDLPOP3Retriever class (or its SSL variant) -- it'll work fine.
 1055    If you see this error message, and you're trying to leave messages on the
 1056    server after retrieval (permanently, or for a few days with delete_after),
 1057    you have a few options to try to resolve it:
 1059      * If your provider also offers IMAP access to your mailbox, try one of
 1060        the IMAP retrievers instead.
 1061      * Change your configuration so you're not leaving messages on the
 1062        server, and use BrokenUIDLPOP3Retriever instead.
 1063      * Talk to your mail hosting provider, and see if they can fix their POP3
 1064        software so that it doesn't have this problem any more.
 1066   MemoryError on OS X
 1068    If you see errors like this while running getmail on Macintosh OS X:
 1070  python2.5(27172) malloc: *** vm_allocate(size=15699968) failed (error code=3)
 1071  python2.5(27172) malloc: *** error: can't allocate region
 1072  python2.5(27172) malloc: *** set a breakpoint in szone_error to debug
 1073  [...]
 1075    ... which then end with MemoryError, please report the problem to Apple.
 1076    The OS X implementation of realloc() is broken, and there's nothing
 1077    getmail can do about it.
 1079   MemoryError when using IMAP
 1081    If you see errors like this while running getmail configured to retrieve
 1082    mail via IMAP or IMAP-over-SSL:
 1084  Python(24006) malloc: *** mmap(size=9875456) failed (error code=12)
 1085  [...]
 1087    ... which then end with MemoryError, you've run into a bug in Python's
 1088    IMAP library. It's fixed in the most recent versions of Python 2.5 and
 1089    2.6. This bug can cause getmail to grow to a huge size, vastly out of
 1090    proportion to the size of the message it's retrieving, at which point
 1091    Python may fail or be killed when the system runs out of memory.
 1093    Upgrade your Python installation to the newest Python 2.5 or 2.6 version
 1094    to fix the problem, or use POP3 instead of IMAP to work around it.
 1096   Errors connecting to Gmail with OpenSSL 1.1.1
 1098    If you experience connection/SSL errors connecting to Gmail servers, and
 1099    your OpenSSL is version 1.1.1 or higher, the problem is that Gmail is
 1100    failing the connection on the basis that SNI is not in use. To work around
 1101    the problem, upgrade to getmail v.5.10 or later, or tell getmail to use
 1102    TLSv1.2 rather than TLS1.3 in your retriever configuration and specify TLS
 1103    v1.2 as the protocol to use:
 1105  [retriever]
 1106  ...
 1107  ssl_version = tlsv1_2