gnus: Washing Mail

 
 6.4.10 Washing Mail
 -------------------
 
 Mailers and list servers are notorious for doing all sorts of really,
 really stupid things with mail.  “Hey, RFC 822 doesn’t explicitly
 prohibit us from adding the string ‘wE aRe ElItE!!!!!1!!’ to the end of
 all lines passing through our server, so let’s do that!!!!1!” Yes, but
 RFC 822 wasn’t designed to be read by morons.  Things that were
 considered to be self-evident were not discussed.  So.  Here we are.
 
    Case in point: The German version of Microsoft Exchange adds ‘AW: ’
 to the subjects of replies instead of ‘Re: ’.  I could pretend to be
 shocked and dismayed by this, but I haven’t got the energy.  It is to
 laugh.
 
    Gnus provides a plethora of functions for washing articles while
 displaying them, but it might be nicer to do the filtering before
 storing the mail to disk.  For that purpose, we have three hooks and
 various functions that can be put in these hooks.
 
 ‘nnmail-prepare-incoming-hook’
      This hook is called before doing anything with the mail and is
      meant for grand, sweeping gestures.  It is called in a buffer that
      contains all the new, incoming mail.  Functions to be used include:
 
      ‘nnheader-ms-strip-cr’
           Remove trailing carriage returns from each line.  This is
           default on Emacs running on MS machines.
 
 ‘nnmail-prepare-incoming-header-hook’
      This hook is called narrowed to each header.  It can be used when
      cleaning up the headers.  Functions that can be used include:
 
      ‘nnmail-remove-leading-whitespace’
           Clear leading white space that “helpful” listservs have added
           to the headers to make them look nice.  Aaah.
 
           (Note that this function works on both the header on the body
           of all messages, so it is a potentially dangerous function to
           use (if a body of a message contains something that looks like
           a header line).  So rather than fix the bug, it is of course
           the right solution to make it into a feature by documenting
           it.)
 
      ‘nnmail-remove-list-identifiers’
           Some list servers add an identifier—for example, ‘(idm)’—to
           the beginning of all ‘Subject’ headers.  I’m sure that’s nice
           for people who use stone age mail readers.  This function will
           remove strings that match the ‘nnmail-list-identifiers’
           regexp, which can also be a list of regexp.
           ‘nnmail-list-identifiers’ may not contain ‘\\(..\\)’.
 
           For instance, if you want to remove the ‘(idm)’ and the
           ‘nagnagnag’ identifiers:
 
                (setq nnmail-list-identifiers
                      '("(idm)" "nagnagnag"))
 
           This can also be done non-destructively with
           ‘gnus-list-identifiers’, SeeArticle Hiding.
 
      ‘nnmail-remove-tabs’
           Translate all ‘TAB’ characters into ‘SPACE’ characters.
 
      ‘nnmail-ignore-broken-references’
           Some mail user agents (e.g., Eudora and Pegasus) produce
           broken ‘References’ headers, but correct ‘In-Reply-To’
           headers.  This function will get rid of the ‘References’
           header if the headers contain a line matching the regular
           expression ‘nnmail-broken-references-mailers’.
 
 ‘nnmail-prepare-incoming-message-hook’
      This hook is called narrowed to each message.  Functions to be used
      include:
 
      ‘article-de-quoted-unreadable’
           Decode Quoted Readable encoding.