1MAILPROCESSING(1)                User Commands               MAILPROCESSING(1)
2
3
4

NAME

6       ~/.mailprocessing/{imap,maildir}.rc  - mailprocessing filter configura‐
7       tion
8

SYNOPSIS

10              processor.maildir_base = '/home/user/Maildir'
11              for mail in processor:
12                pass
13

DESCRIPTION

15       maildirproc's and imapproc's configuration, the rc file, is not  a  set
16       of  declarative rules.  Instead, it is a simple Python program that has
17       access to a "maildir processor" object  which  produces  mail  objects.
18       The  mail  processing  logic is defined in terms of if/elif/else state‐
19       ments and actions are performed by calling methods on the mail objects.
20
21       Maildir  and  IMAP  specific  functionality  is  implemented   by   the
22       MaildirProcessor and ImapProcessor classes, respecitively.
23
24   The MailProcessor class
25       Iteration  over  a MailProcessor instance yields Mail instances.  imap‐
26       proc and maildirproc will create a MailProcessor instance for you which
27       is  available  as  the  global processor variable in the rc file's name
28       space.
29
30   Readable and writable properties
31       auto_reload_rcfile
32              Whether the rc file should be automatically reloaded when it has
33              been modified.  Assignment to this property overrides the corre‐
34              sponding command-line option.
35
36       maildir_base
37              The base directory of maildirs.   Assignment  to  this  property
38              overrides  the corresponding command-line option.  This property
39              is specific to MaildirProcessor instances.
40
41       maildirs
42              A list of maildirs (subdirectories of the maildir base  directo‐
43              ry).   Assignment  to  this property overrides the corresponding
44              command-line option.  This property is specific  to  MaildirPro‐
45              cessor instances.
46
47       folders
48              A  list  of IMAP folders.  Assignment to this property overrides
49              the corresponding command-line option.  This property is specif‐
50              ic to ImapProcessor instances.
51
52   Methods
53       create_folder(folder, parents=True, prefix='.')
54              Create  folder  folder  (a string, or a list of namespace compo‐
55              nents).  This method can safely be called for existing  folders.
56              If the folder exists already, the method will log that it exists
57              and exit without trying  to  create  it.   For  MaildirProcessor
58              folder  does not need to be on the same file system as the mail.
59              If the folder path is relative, it will be  considered  relative
60              to  the  maildir  base  directory.  The boolean keyword argument
61              parents governs whether parent  folders  should  be  created  as
62              well,   e.g.    if   you  create  'github.jrosdahl.maildirproc',
63              'github' and 'github.jrosdahl' will be created as well.  This is
64              the  default behaviour.  The prefix keyword argument specifies a
65              prefix to prepend the folder name with.  This  defaults  to  the
66              processors  prefix  attribute which is set via the --prefix com‐
67              mand line attribute for MaildirProcessor instances.
68
69   Writable properties
70       logfile
71              Location of the log file.  Assignment to this property overrides
72              the corresponding command-line option.
73
74   The Mail class
75       Indexing a Mail instance with a header name (a string) returns a Header
76       instance.  Example:
77
78              for mail in processor:
79                myheader = mail['From']
80
81   Readable properties
82       folder The IMAP folder in which the mail is situated.  Only  applicable
83              for ImapProcessor.
84
85       maildir
86              The  maildir in which the mail is situated.  Only applicable for
87              MaildirProcessor.
88
89       path   Full  filesystem  path  to  the  mail.   Only   applicable   for
90              MaildirProcessor.
91
92       target A Target instance.
93
94   Methods
95       copy(maildir, create=False)
96              Copy  the  mail to maildir (a string).  maildir does not need to
97              be on the same file system as the mail.  If the maildir path  is
98              relative, it will be considered relative to the maildir base di‐
99              rectory.  If the optional create  keyword  argument  is  set  to
100              True,  the folder (and its parent folders) will be created if it
101              does not exist.  By default non-existent folders are not  creat‐
102              ed.
103
104       delete()
105              Delete the mail.
106
107       forward(addresses[, env_sender])
108              Forward  the  mail to one or several e-mail addresses and delete
109              the mail.  addresses can  be  either  a  string  or  a  list  of
110              strings.   env_sender (optional) specifies which envelope sender
111              address to use.
112
113       forward_copy(addresses[, env_sender])
114              Forward a copy of the mail to one or several  e-mail  addresses.
115              addresses  can  be  either  a  string  or  a  list  of  strings.
116              env_sender (optional) specifies which envelope sender address to
117              use.
118
119       from_mailing_list(list)
120              Check  whether the mail originated from the mailing list list (a
121              string).  Currently,  the  headers  Delivered-To,  Mailing-List,
122              X-BeenThere and X-Mailing-List are checked.  Returns a boolean.
123
124       strict_mailing_list(list)
125              Check  whether the mail originated from the mailing list list (a
126              string).  It is a bit stricter than from_mailing_list() and only
127              matches  the  content  of  typical  mailing list headers, namely
128              List-Archive, List-Help, List-ID, List-Post, List-Subscribe  and
129              X-Mailing-List.
130
131       is_seen()
132              Returns  True  if  the  message has been seen by the user, False
133              otherwise.
134
135       is_flagged()
136              Returns True if the message has been flagged by the user,  False
137              otherwise.
138
139       move(maildir, create=False)
140              Move  the  mail  to  maildir (a string).  maildir must be on the
141              same file system as the mail, otherwise nothing will happen  and
142              an  error  will  be  logged.   For  MaildirProcessor, a relative
143              maildir path, will be considered relative to  the  maildir  base
144              directory.   If  the  optional create keyword argument is set to
145              True, the folder (and its parent folders) will be created if  it
146              does  not exist.  By default non-existent folders are not creat‐
147              ed.
148
149   The Header class
150   Methods
151       contains(case-insensitive-string)
152              Check whether case-insensitive-string is  part  of  the  header.
153              Returns a boolean.
154
155       matches(case-insensitive-regexp)
156              Check whether case-insensitive-regexp (with an implicit .*  pre‐
157              fix) matches the header.  Returns a boolean.
158
159   The Target class
160   Methods
161       contains(case-insensitive-string)
162              Check whether case-insensitive-string is part of the  To  or  Cc
163              header.  Returns a boolean.
164
165       matches(case-insensitive-regexp)
166              Check whether case-insensitive-regexp (with an implicit .*  pre‐
167              fix) matches the To or Cc header.  Returns a boolean.
168

EXAMPLES

170       For some examples, see the examples directory.
171

SEE ALSO

173       imapproc(1), maildirproc(1)
174
175
176
177User Commands                                                MAILPROCESSING(1)
Impressum