deletemail.1



     NAME
          deletemail - remove old mail from server

     SYNOPSIS
          deletemail [-nqsuv[v]] [-f file]

          deletemail -h | -V

     DESCRIPTION
          deletemail is a non-interactive tool for deleting mail which
          is older than a configurable number of days from one or more
          IMAP mailboxes.  By default, mail which is not marked as
          seen on the server will not be deleted.  Currently, the
          IMAP4 and IMAP4rev1 protocols are supported, optionally
          using SSL/TLS for secure IMAP connections.

     OPTIONS
          -f file
               Use file instead of $HOME/.deletemailrc for
               configuration.

          -h   Print a short description of all available options and
               exit.

          -n   Mark messages as deleted on the server, but don't
               expunge them (that is, omit the IMAP CLOSE command).
               This might be useful in order to test whether or not
               everything works as expected.  However, please note
               that the "deleted" flags will not be revoked by
               deletemail, so these messages might be expunged by
               another IMAP client accessing the mailbox.

          -q   Quiet output, only error messages are printed.

          -s   Don't use unique message IDs in IMAP commands.  By
               default, deletemail will use UIDs when issuing IMAP
               SEARCH or STORE commands, since UIDs are safer in case
               multiple IMAP clients are accessing the mailbox at the
               same time.  However, there are IMAP servers which seem
               to have problems using UIDs.  Thus, if you encounter
               strange behaviour (like the server unexpectedly closing
               the connection), this option might be helpful.

          -u   Delete any message which is older than the configured
               number of days, no matter whether or not the message is
               marked as seen.

          -V   Print version information and exit.

          -v[v]
               If the -v option is used, all commands sent to the
               server and all server responses will be printed to the
               standard error stream.  If -v is specified twice,
               (quite a lot of) additional debug output will be
               produced.

     CONFIGURATION FILE
          By default, the configuration file $HOME/.deletemailrc will
          be read.  Each IMAP account on which deletemail should
          operate is configured by using the keyword ACCOUNT, followed
          by variable: value pairs specifying the account settings;
          one variable: value pair per line.  Apart from that, the
          keyword GLOBAL, followed by variable: value pairs may
          optionally be used for specifying default settings.  If
          GLOBAL is used, it must be declared prior to any ACCOUNT
          settings.  The default settings will only take effect if
          they are not specified for a given ACCOUNT.

          Configuration values may include all ASCII characters.
          Empty lines and the rest of a line after a "#" will be
          ignored.  Whitespace and "#" must be escaped using a backslash
          if the value is not quoted with single or double quotes.  If
          the value is quoted, the quote sign must be escaped using a
          backslash.  A literal backslash must always be escaped using
          another backslash.  If the last character of a configuration
          line is a backslash, the following line will be appended
          prior to parsing.

        Required Configuration Variables
          The following configuration variables must be set, either by
          specifying default settings using the keyword GLOBAL and/or
          by specifying them for each ACCOUNT.

          days: <integer>
               The number of days that messages should stay on the
               server.  Messages which are not older than specified
               here will not be deleted.

          host: <string>
               The IMAP server name or IP address.

          pass: <string>
               The password for authentication on the server.

          user: <string>
               The username for authentication on the server.

        Optional Configuration Variables
          The following configuration variables may be set, either by
          specifying default settings using the keyword GLOBAL and/or
          by specifying them for one or more ACCOUNTs.

          expunge: <yes|no>
               If set to no, messages will still be marked as deleted
               on the server, but they won't be expunged by
               deletemail.  However, these messages might be expunged
               by another IMAP client accessing the mailbox.  This
               variable will be overridden by the -n command line
               switch.  Default: yes.

          folder: <string> [string...]
               The mailbox name.  Multiple folders may be specified
               using a space delimited list.  Default: INBOX.

          port: <integer>
               The server port number.  Default:  993 for SSL
               connections, 143 otherwise.

          ssl: yes|no|starttls
               Specifies usage of SSL/TLS for secure IMAP connections.
               If set to yes, SSL on connect will be used; if set to
               starttls, the TLS connection will be initiated using
               STARTTLS.  In both cases, deletemail will exit with an
               error prior to sending any login information if the
               server doesn't support the respective mechanism.
               Default: no.  This variable is only available if
               deletemail was built with SSL support.

          unseen: yes|no
               If set to yes, any message that is older than the
               configured number of days will be deleted, no matter
               whether or not the message is marked as seen.  If set
               to no, messages which are not marked as seen will never
               be deleted.  This variable will be overridden by the -u
               command line switch.  Default: no.

          use_uid: yes|no
               If set to no, deletemail won't use unique message IDs
               when talking to the IMAP server.  See the -s command
               line switch (which will override the use_uid setting)
               for implications.  Default: yes.

     RETURN VALUE
          Upon successful completion, deletemail returns 0.  If any
          sort of error is encountered, deletemail returns a value
          other than 0.

     EXAMPLES
          Configure deletemail via the file $HOME/.deletemailrc, which
          could look like this:

               ACCOUNT # Toms INBOX on the ISPs IMAP server
                 host: imap.provider.com
                 user: tom
                 pass: h0lyPa55
                 days: 7  # delete mail if it's older than a week
                 ssl: yes # use SSL for secure IMAP connections

          Test your configuration by creating verbose output and not
          expunging deleted messages on the server:

               deletemail -nv

          Run deletemail once an hour (at twenty past) by using a
          crontab(5) entry like the following:

               20 * * * * /usr/local/bin/deletemail -q

     ENVIRONMENT
          HOME If the configuration file is not specified on the
               command line, $HOME/.deletemailrc will be used.

     FILES

          $HOME/.deletemailrc   default configuration file

     CAVEATS
          For SSL connections, deletemail currently does not support
          any mechanism to prevent "man in the middle" attacks.
          Future releases will probably provide certificate and key
          fingerprint checking.

          Apart from that, on systems that lack a useable random
          device (like /dev/urandom), deletemail will try to collect
          some random data for seeding OpenSSLs PRNG on it's own.
          However, this is insecure.  Please consider installing an
          entropy gathering daemon like EGD or PRNGD if your system
          doesn't provide a useable random device (the output of
          deletemail -vv will tell you whether or not that's the
          case).  See the OpenSSL manual page RAND_egd(3) for
          information on where to get and how to install an entropy
          gathering daemon so that OpenSSL will use it automatically.

     BUGS
          The mailbox name may not include non-ASCII characters, since
          they won't be encoded according to the IMAP standard when
          talking to the server.  IPv6 is not supported.

          I'm sure there are more bugs, please let me know if you find
          them.

     AUTHOR
          Holger Weiss <holger@jhweiss.de>

     SEE ALSO
          fetchmail(1), crontab(1), crontab(5), cron(8), ssl(3),
          crypto(3)


Man(1) output converted with man2html