1IMAPFILTER_CONFIG(5)        BSD File Formats Manual       IMAPFILTER_CONFIG(5)
2

NAME

4     imapfilter_config — imapfilter configuration file
5

SYNOPSIS

7     $HOME/.imapfilter/config.lua
8

DESCRIPTION

10     imapfilter(1) uses the Lua programming language (http://www.lua.org) as a
11     configuration and extension language, therefore the configuration file is
12     a Lua script.
13
14     Although knowledge of Lua is not required to use imapfilter(1), it is
15     nonetheless recommended, especially if one wants to extend imapfilter(1).
16     The user is advised to have a look at the available Lua documentation at:
17
18           http://www.lua.org/docs.html
19

CONVENTIONS

21     A brief description of the Lua values and types mentioned hereafter in
22     the manual page follows:
23
24         The nil is the type of the value ``nil'' , whose main property is to
25         be different from any other value; usually it represents the absence
26         of a useful value.
27
28         The boolean is the type of the values ``true'' and ``false''.  Both
29         ``nil'' and ``false'' make a condition false; any other value makes
30         it true.
31
32         The type number represents real numbers.
33
34         The type string represents a sequence of characters and can be
35         defined using single quotes, double quotes or double square brackets.
36
37         The type table implements associative arrays, that is, arrays that
38         can be indexed not only with numbers, but with any value.
39
40         A function is a first-class value; it can be stored in variables,
41         passed as argument to other functions, and returned as a result.
42

OPTIONS

44     Program's options are set using an already initialised table named
45     ``options'' , in the following manner:
46
47         options.timeout = 120
48         options.namespace = false
49         options.charset = 'ISO-8859-1'
50
51     Available options are:
52
53     cache   When this option is enabled, parts of messages are cached locally
54             in memory to avoid being downloaded more than once.  The cache is
55             preserved for the current session only. This variable takes a
56             boolean as a value. Default is ``true''.
57
58     certificates
59             When this option is enabled, the server certificate can be
60             accepted and stored, in order to validate the authenticity of the
61             server in future connections. This variable takes a boolean as a
62             value. Default is ``true''.
63
64     charset
65             Indicates to the server the character set of the strings for the
66             searching methods.  This variable takes a string as a value.  By
67             default no character set is set, and thus plain ASCII should be
68             assumed by the server.
69
70     create  According to the IMAP specification, when trying to write a mes‐
71             sage to a non-existent mailbox, the server must send a hint to
72             the client, whether it should create the mailbox and try again or
73             not. However some IMAP servers don't follow the specification and
74             don't send the correct response code to the client. By enabling
75             this option the client tries to create the mailbox, despite of
76             the server's response. This variable takes a boolean as a value.
77             Default is ``false''.
78
79     close   This option controls whether the currently selected mailbox is
80             implicitly closed at the end of each performed operation, thus
81             removing all messages that are marked deleted. This variable
82             takes a boolean as a value.  Default is ``false''.
83
84     crammd5
85             When this option is enabled and the server supports the Chal‐
86             lenge-Response Authentication Mechanism (specifically CRAM-MD5),
87             this method will be used for user authentication instead of a
88             plaintext password LOGIN.  This variable takes a boolean as a
89             value.  Default is ``true''.
90
91     expunge
92             Normally, messages are marked for deletion and are actually
93             deleted when the mailbox is closed.  When this option is enabled,
94             messages are expunged immediately after being marked deleted.
95             This variable takes a boolean as a value.  Default is ``true''.
96
97     info    When this options is enabled, a summary of the program's actions
98             is printed, while processing mailboxes.  This variable takes a
99             boolean as a value.  Default is ``true''.
100
101     keepalive
102             The time in minutes before terminating and re-issuing the IDLE
103             command, in order to keep alive the connection, by resetting the
104             inactivity timeout of the server.  A standards compliant server
105             must have an inactivity timeout of at least 30 minutes.  But it
106             may happen that some IMAP servers don't respect that, or some
107             intermediary network device has a shorter timeout.  By setting
108             this option the above problem can be worked around. This variable
109             takes a number as a value. Default is ``29'' minutes.
110
111     namespace
112             When enabled, the program gets the namespace of the user's per‐
113             sonal mailboxes, and applies automatically the prefix and hierar‐
114             chy delimiter to any mailboxes residing on the mail server; the
115             user must use the `/' character as the delimiter and ``'' (ie.
116             nothing) as the prefix, regardless of the folder format of the
117             mail server.  This must be disabled, if the user wants to manu‐
118             ally specify mailbox names (eg. because they are not part of the
119             user's personal namespace mailboxes).  This variable takes
120             boolean as a value.  Default is ``true''.
121
122     starttls
123             When this option is enabled and the server supports the IMAP
124             STARTTLS extension, a TLS connection will be negotiated with the
125             mail server in the beginning of the session.  This variable takes
126             a boolean as value.  Default is ``true''.
127
128     subscribe
129             By enabling this option new mailboxes that were automatically
130             created, get also subscribed; they are set active in order for
131             IMAP clients to recognize them.  This variable takes a boolean as
132             a value.  Default is ``false''.
133
134     timeout
135             The time in seconds for the program to wait for a mail server's
136             response.  If not set, the client will block indefinitely.  This
137             variable takes a number as a value.  By default no value is set.
138

ACCOUNTS

140     Accounts are initialized using the IMAP() function, and the details of
141     the connection are defined using an account table:
142
143         myaccount = IMAP {
144             server = 'imap.mail.server',
145             username = 'me',
146             password = 'secret',
147             ssl = 'ssl3'
148         }
149
150     An account table must have the following elements:
151
152     server  The hostname of the IMAP server to connect to.  It takes a string
153             as a value.
154
155     username
156             User's name.  It takes a string as a value.
157
158     An account table can also have the following optional elements:
159
160     password
161             User's secret keyword.  If a password wasn't supplied the user
162             will be asked to enter one interactively the first time it will
163             be needed.  It takes a string as a value.
164
165     port    The port to connect to.  It takes a number as a value.  Default
166             is ``143'' for imap and ``993'' for imaps.
167
168     ssl     Forces an imaps connection and specifies the SSL/TLS protocol to
169             be used.  It takes a string as a value, specifically one of:
170             ``ssl2'' , ``ssl3'' , ``tls1''.
171
172   LISTING
173     The following methods can be used on an account to list mailboxes in a
174     folder of an account:
175
176     list_all(folder)
177             Lists all the available mailboxes in the folder (string), and
178             returns a table that contains strings, the available mailboxes,
179             and a table that contains strings, the available folders.
180
181     list_subscribed(folder)
182             Lists all the subscribed mailboxes in the folder (string), and
183             returns a table that contains strings, the subscribed mailboxes,
184             and a table that contains strings, the subscribed folders.
185
186     The following methods can be used on an account to list mailboxes, using
187     wildcards, in a folder of an account.  The `*' wildcard, matches any
188     character and the `%' matches any character except the folder delimiter,
189     ie.  non-recursively:
190
191     list_all(folder, mailbox)
192             Lists all the available mailboxes in the folder (string) with the
193             name mailbox (string), and returns a table that contains strings,
194             the available mailboxes, and a table that contains strings, the
195             available folders.  Wildcards may only be used in the mailbox
196             argument.
197
198     list_subscribed(folder, mailbox)
199             Lists all the subscribed mailboxes in the folder (string) with
200             the name mailbox (string), and returns a table that contains
201             strings, the subscribed mailboxes, and a table that contains
202             strings, the subscribed folders.  Wildcards may only be used in
203             the mailbox argument.
204
205     Examples:
206
207         mailboxes, folders = myaccount:list_subscribed('myfolder')
208         mailboxes, folders = myaccount:list_all('myfolder/mysubfolder', '*')
209
210   MANIPULATING
211     The following methods can be used to manipulate mailboxes in an account:
212
213     create_mailbox(name)
214             Creates the name (string) mailbox.
215
216     delete_mailbox(name)
217             Deletes the name (string) mailbox.
218
219     rename_mailbox(oldname, newname)
220             Renames the oldname (string) mailbox to newname (string).
221
222     subscribe_mailbox(name)
223             Subscribes the name (string) mailbox.
224
225     unsubscribe_mailbox(name)
226             Unsubscribes the name (string) mailbox.
227
228     Examples:
229
230         myaccount:create_mailbox('mymailbox')
231         myaccount:subscribe_mailbox('mymailbox')
232         myaccount:unsubscribe_mailbox('myfolder/mymailbox')
233         myaccount:delete_mailbox('myfolder/mymailbox')
234

MAILBOXES

236     After an IMAP account has been initialized, mailboxes residing in that
237     account can be accessed simply as elements of the account table:
238
239         myaccount.mymailbox
240
241     If mailbox names don't only include letters, digits and underscores, or
242     begin with a digit, an alternative form must be used:
243
244         myaccount['mymailbox']
245
246     A mailbox inside a folder can be only accessed by using the alternative
247     form:
248
249         myaccount['myfolder/mymailbox']
250
251     The methods that are available for an account (eg.  list_all(),
252     create_mailbox(), etc.) , are considered keywords and must not be used as
253     mailbox names, and the same also applies for any string starting with an
254     underscore, as they are considered reserved.
255
256   CHECKING
257     The following methods can be used to check the status of a mailbox:
258
259     check_status()
260
261             The check_status() method gets the current status of a mailbox,
262             and returns three values of number type: the total number of mes‐
263             sages, the number of recent messages and the number of unseen
264             messages in the mailbox.
265
266     enter_idle()
267             The enter_idle() method implements the IMAP IDLE (RFC 2177)
268             extension.  By using this extension it's not necessary to poll
269             the server for changes to the selected mailbox (ie.  using the
270             check_status() method), but instead the server sends an update
271             when there is a change in the mailbox (eg. in case of new mail).
272             When the enter_idle() method has been called no more commands in
273             the configuration file are executed until an update is received,
274             at which point the enter_idle() method returns.  For the
275             enter_idle() to work, the IDLE extension has to be supported by
276             the IMAP server.  The enter_idle() method returns one value of
277             type boolean: ``true'' if the IDLE extension is supported and
278             there was a update in the mailbox, and ``false'' if the IDLE
279             extension is not supported, in which case the method returns
280             immediately.
281
282     Examples:
283
284         exist, unread, unseen = myaccount.mymailbox:check_status()
285         update = myaccount.mymailbox:enter_idle()
286
287   SEARCHING
288     The searching methods in this subsection can be applied to any mailbox.
289     They return a special form of table, that contains the messages that
290     match the searching method.  This table can be combined with other tables
291     using logic theory. There are three available operations, that implement
292     logical ``or'', logical ``and'' and logical ``not''.
293
294     The logical ``or'' is implemented using the `+' operator:
295
296         results = myaccount.mymailbox:is_unseen() +
297                   myaccount.mymailbox:is_larger(100000)
298
299     The logical ``and'' is implemented using the `*' operator:
300
301         results = myaccount.mymailbox:is_unseen() *
302                   myaccount.mymailbox:is_larger(100000)
303
304     The logical ``not'' is implemented using the `-' operator:
305
306         results = myaccount.mymailbox:is_unseen() -
307                   myaccount.mymailbox:is_larger(100000)
308
309     The three logical operators can be combined in the same expression. The
310     logical ``and'' has higher precedence than the logical ``or'' and the
311     logical ``not'', with the latter two having the same precedence, and
312     parentheses may be used to change this behaviour:
313
314         results = myaccount.mymailbox:is_unseen() +
315                   myaccount.mymailbox:is_larger(100000) *
316                   myaccount.mymailbox:contain_subject('test')
317
318         results = ( myaccount.mymailbox:is_unseen() +
319                     myaccount.mymailbox:is_larger(100000) ) *
320                     myaccount.mymailbox:contain_subject('test')
321
322     The returned tables of the searching methods can also be stored in vari‐
323     ables and then further processed:
324
325         unseen = myaccount.myaccount:is_unseen()
326         larger = myaccount.mymailbox:is_larger(100000)
327         subject = myaccount.mymailbox:contain_subject('test')
328         results = unseen + larger * subject
329
330     A composite filter that includes one or more simple rules can be defined:
331
332         myfilter = function ()
333                        return myaccount.mymailbox:is_unseen() +
334                               myaccount.mymailbox:is_larger(100000) *
335                               myaccount.mymailbox:contain_subject('test')
336                    end
337
338         results = myfilter()
339
340     Composite filters can may be more dynamic by adding arguments:
341
342         myfilter = function (mailbox, size, subject)
343                        return mailbox:is_unseen() +
344                               mailbox:is_larger(size) *
345                               mailbox:contain_subject(subject)
346                    end
347
348         results = myfilter(myaccount.mailbox, 100000, 'test')
349
350     It is also possible to combine the searching methods in different mail‐
351     boxes, either at the same or different accounts, for example when the
352     same actions will be executed on messages residing in different mailboxes
353     or accounts.
354
355         results = myaccount.mymailbox:is_unseen() +
356                   myaccount.othermailbox:is_larger(100000) +
357                   otheraccount.othermailbox:contain_subject('test')
358
359     The following method can be used to get all messages in a mailbox:
360
361     select_all()
362             All messages.
363
364     The following methods can be used to search for messages that are in a
365     specific state:
366
367     is_answered()
368             Messages that have been answered.
369
370     is_deleted()
371             Messages that are marked for later removal.
372
373     is_draft()
374             Messages that have not completed composition.
375
376     is_flagged()
377             Messages that are flagged for urgent/special attention.
378
379     is_new()
380             Messages that are recently arrived (this session is the first to
381             have been notified about these messages) and have not been read.
382
383     is_old()
384             Messages that are not recently arrived (this session is not the
385             first to have been notified about these messages) and have not
386             been read.
387
388     is_recent()
389             Messages that are recently arrived (this session is the first to
390             have been notified about these messages).
391
392     is_seen()
393             Messages that have been read.
394
395     is_unanswered()
396             Messages that have not been answered.
397
398     is_undeleted()
399             Messages that are not marked for later removal.
400
401     is_undraft()
402             Messages that have completed composition.
403
404     is_unflagged()
405             Messages that are not flagged for urgent/special attention.
406
407     is_unseen()
408             Messages that have not been read.
409
410     The following method can be used to search for messages that have a spe‐
411     cific flag set:
412
413     has_flag(keyword)
414             Messages with the specified keyword flag (string) set.
415
416     The following methods can be used to search for messages based on their
417     size:
418
419     is_larger(size)
420             Messages that are larger than the size (number) in octets
421             (bytes).
422
423     is_smaller(size)
424             Messages that are smaller than the size (number) in octets
425             (bytes).
426
427     The following methods can be used to search for messages based on their
428     age:
429
430     is_newer(age)
431             Messages that are newer than the age (number) in days.
432
433     is_older(age)
434             Messages that are older than the age (number) in days.
435
436     The following methods can be used to search for messages based on their
437     arrival or sent date, in the ``day-month-year'' form, where day is the
438     day of the month as a decimal number (01-31), month is the abbreviated
439     month (``Jan'', ``Feb'', ``Mar'', ``Apr'', ``May'', ``Jun'', ``Jul'',
440     ``Aug'', ``Sep'', ``Oct'', ``Nov'', ``Dec'') and year is the year as dec‐
441     imal number including the century (eg. 2007):
442
443     arrived_before(date)
444             messages that have arrived before the date (string), where date
445             is in the ``day-month-year'' form.
446
447     arrived_on(date)
448             Messages that have arrived on the date (string), where date is in
449             the ``day-month-year'' form.
450
451     arrived_since(date)
452             Messages that have arrived after the date (string), where date is
453             in the ``day-month-year'' form.
454
455     sent_before(date)
456             Messages that have been sent before the date (string), where date
457             is in the ``day-month-year'' form.
458
459     sent_on(date)
460             Messages that have been sent on the date (string), where date is
461             in the ``day-month-year'' form.
462
463     sent_since(date)
464             Messages that have been sent after the date (string), where date
465             is in the ``day-month-year'' form.
466
467     The following methods can be used to search for messages that contain a
468     specific word or phrase:
469
470     contain_bcc(string)
471             Messages that contain the string (string) in the ``Bcc'' header
472             field.
473
474     contain_cc(string)
475             Messages that contain the string (string) in the ``Cc'' header
476             field.
477
478     contain_from(string)
479             Messages that contain the string (string) in the ``From'' header
480             field.
481
482     contain_subject(string)
483             Messages that contain the string (string) in the ``Subject''
484             header field.
485
486     contain_to(string)
487             Messages that contain the string (string) in the ``To'' header
488             field.
489
490     contain_field(field, string)
491             Messages that contain the string (string) in the field (string)
492             header field.
493
494     contain_body(string)
495             Messages that contain the string (string) in the message body.
496
497     contain_message(string)
498             Messages that contain the string (string) in the message.
499
500     The following methods can be used to search for messages that match a
501     specific regular expression pattern.
502
503     This way of searching is not supported by the IMAP protocol, and this
504     means that what actually happens under the hood, is that the relevant
505     parts of all the messages are downloaded and matched locally.  It is
506     therefore recommended to use these methods with meta-searching (see fol‐
507     lowing section), in order to narrow down the set of messages that should
508     be searched, and thus minimize what will be downloaded.
509
510     Note that due to Lua using backslash `\' as an escape character for its
511     strings, one has to double backslashes in order to insert a single back‐
512     slash inside a regular expression pattern:
513
514     match_bcc(pattern)
515             Messages that match the regular expression pattern (string) in
516             the ``Bcc'' header field.
517
518     match_cc(pattern)
519             Messages that match the regular expression pattern (string) in
520             the ``Cc'' header field.
521
522     match_from(pattern)
523             Messages that match the regular expression pattern (string) in
524             the ``From'' header field.
525
526     match_subject(pattern)
527             Messages that match the regular expression pattern (string) in
528             the ``Subject'' header field.
529
530     match_to(pattern)
531             Messages that match the regular expression pattern (string) in
532             the ``To'' header field.
533
534     match_field(field, pattern)
535             Messages that match the regular expression pattern (string) in
536             the field (string) header field.
537
538     match_header(pattern)
539             Messages that match the regular expression pattern (string) in
540             the message header.
541
542     match_body(pattern)
543             Messages that match the regular expression pattern (string) in
544             the message body.
545
546     match_message(pattern)
547             Messages that match the regular expression pattern (string) in
548             the message.
549
550     The following method can be used to search for messages using user
551     queries based on the IMAP specification (RFC 3501 Section 6.4.4):
552
553     send_query(criteria)
554             Searches messages by sending an IMAP search query as described in
555             the search criteria (string).
556
557     Examples:
558
559         results = myaccount.mymailbox:select_all()
560         results = myaccount.mymailbox:is_new()
561         results = myaccount.mymailbox:is_recent()
562         results = myaccount.mymailbox:is_larger(100000)
563         results = myaccount.mymailbox:is_older(10)
564         results = myaccount.mymailbox:has_flag('MyFlag')
565         results = myaccount.mymailbox:arrived_before('01-Jan-2007')
566         results = myaccount.mymailbox:sent_since('01-Jan-2007')
567         results = myaccount.mymailbox:contain_subject('test')
568         results = myaccount.mymailbox:contain_field('Sender', 'user@host')
569         results = myaccount.mymailbox:contain_body('hello world')
570         results = myaccount.mymailbox:match_from('.*(user1|user2)@host')
571         results = myaccount.mymailbox:send_query('ALL')
572
573         results = myaccount['mymailbox']:is_new()
574         results = myaccount['myfolder/mymailbox']:is_recent()
575

RESULTS

577     After one of more searching methods have been applied to one or more
578     mailboxes, the result contains all the necessary information, such as
579     which messages matched in which mailboxes.  Using this result these mes‐
580     sages can be either searched further or processed in various way.
581
582   META-SEARCHING
583     The results of the searching methods can be searched further on in the
584     same way as searching is done in mailboxes.  The difference is that
585     instead of doing the search in the whole mailbox, ie. in all the mes‐
586     sages, it is instead done only to those messages that were returned in a
587     previous search.
588
589     Examples:
590
591         results:match_message('^[Hh]ello world!?$')
592         myaccount.mymailbox:is_new():match_body('^[Ww]orld, hello!?$')
593
594   PROCESSING
595     The processing methods are applied to the results that searching
596     returned.
597
598     The following method can be used to delete messages in a mailbox:
599
600     delete_messages()
601             Deletes the messages that matched.
602
603     The following methods can be used to copy and move messages in a mailbox
604     at the same or different accounts.  If the destination mailbox is in a
605     different account than the source mailbox, then the messages are down‐
606     loaded and then uploaded to the destination:
607
608     copy_messages(destination)
609             Copies the messages to the destination, which is a mailbox at an
610             account.
611
612     move_messages(destination)
613             Moves the messages to the destination, which is a mailbox at an
614             account.
615
616     The following methods can be used to mark messages in a mailbox:
617
618     mark_answered()
619             Marks the messages as answered.
620
621     mark_deleted()
622             Marks the messages for later removal.
623
624     mark_draft()
625             Marks the messages as draft.
626
627     mark_flagged()
628             Marks the messages for urgent/special attention.
629
630     mark_seen()
631             Marks the messages as read.
632
633     unmark_answered()
634             Unmarks the messages that have been marked as answered.
635
636     unmark_deleted()
637             Unmarks the messages that have been marked for later removal.
638
639     unmark_draft()
640             Unmarks the messages that have been marked as draft.
641
642     unmark_flagged()
643             Unmarks the messages that have been marked for urgent/special
644             attention.
645
646     unmark_seen()
647             Unmarks the messages that have been marked as read.
648
649     The following methods can be used to flag messages in a mailbox. The
650     standard system flags are ``\Answered'', ``\Deleted'', ``\Draft'',
651     ``\Flagged'', ``\Seen'', while if the server supports it, new user key‐
652     words may be defined:
653
654     add_flags(flags)
655             Adds the flags (table that contains strings) to the messages.
656
657     remove_flags(flags)
658             Removes the flags (table that contains strings) from the mes‐
659             sages.
660
661     replace_flags(flags)
662             Replaces the flags (table that contains strings) of the messages.
663
664     Examples:
665
666         results:delete_messages()
667         results:copy_messages(myaccount.othermailbox)
668         results:move_messages(otheraccount.mymailbox)
669         results:mark_seen()
670         results:unmark_flagged()
671         results:add_flags({ 'MyFlag', '\\Seen' })
672         results:remove_flags({ '\\Seen' })
673
674         results:move_messages(otheraccount['myfolder/mymailbox'])
675

MESSAGES

677     The messages that are residing in any mailbox can be also accessed, as a
678     whole or in parts.  Messages can be accessed using their unique id (UID):
679
680         myaccount.mymailbox[22]
681
682     The UIDs of messages the user is interested in, are gained from the
683     results of searching:
684
685         results = account.INBOX:is_unread()
686         for _, message in ipairs(results) do
687             mailbox, uid = unpack(message)
688             header = mailbox[uid]:fetch_header()
689         end
690
691   FETCHING
692     The following methods can be used to fetch parts of messages.  The meth‐
693     ods return a string.  The downloaded message parts are cached locally, so
694     they can be reused inside the same program session:
695
696     fetch_message()
697             Fetches the header and body of the message.
698
699     fetch_header()
700             Fetches the header of the message.
701
702     fetch_body()
703             Fetches the body of the messages.
704
705     fetch_field(field)
706             Fetches the specified header field (string) of the message.
707
708     fetch_part(part)
709             Fetches the specified part (string) of the message.
710
711     The following methods can be used to fetch details about the state of a
712     message:
713
714     fetch_flags()
715             Fetches the flags of the message.  Returns a table, of strings.
716
717     fetch_date()
718             Fetches the internal date of the message.  Returns a string.
719
720     fetch_size()
721             Fetches the size of the message.  Returns a number.
722
723     fetch_structure()
724             Fetches the body structure of the message. Returns a table that
725             has as keys the parts of the message, and as values a table that
726             has one mandatory element, the type (string) of the part, and two
727             optional elements, the size (number) and name (string) of the
728             part.
729
730     Examples:
731
732         myaccount.mymailbox[2]:fetch_message()
733         myaccount.mymailbox[3]:fetch_field('subject')
734         myaccount.mymailbox[5]:fetch_part('1.1')
735
736         myaccount['mymailbox'][7]:fetch_message()
737         myaccount['myfolder/mymailbox'][11]:fetch_message()
738

FUNCTIONS

740     The following auxiliary functions are also available for convenience:
741
742     form_date(days)
743             Forms a date in ``day-month-year'' format that the system had
744             before the number of days (number), and returns it as a string.
745
746     get_password(prompt)
747             Displays the specified prompt (string), and reads a password,
748             while character echoing is turned off.  Returns that password as
749             a string.
750
751     become_daemon(interval, commands)
752             Detaches the program from the controlling terminal and runs it in
753             the background as system daemon. The program will then repeatedly
754             poll at the specified interval (number) in seconds. Each time the
755             program wakes up, the commands (function) are executed.
756
757     pipe_to(command, data)
758             Executes the system's command (string) and sends the data
759             (string) to the standard input channel of the subprocess. Returns
760             a number, the exit status of the child process.
761
762     pipe_from(command)
763             Executes the system's command (string) and retrieves the data
764             from the standard output channel of the subprocess.  Returns a
765             number, the exit status of the child process, and a string, the
766             output of the child process.
767
768     regex_search(pattern, string)
769             Implements Perl-compatible regular expressions
770             (http://www.pcre.org).  The pattern (string) is a PCRE pattern.
771             The string (string) is the subject string in which the pattern is
772             matched against. Returns at least a boolean, that denotes if the
773             match was successful, and any captures which are of string type.
774             Note that due to Lua using backslash `\' as an escape character
775             for its strings, one has to double backslashes in order to insert
776             a single backslash inside a regular expression pattern:
777
778     Examples:
779
780         date = form_date(14)
781         password = get_password('Enter password: ')
782         become_daemon(600, myfunction)
783         status = pipe_to('mycommandline', 'mydata')
784         status, data = pipe_from('mycommandline')
785         success, capture = regex_search('^[PpCcRrEe]: (\\w)$', 'mystring')
786

EXAMPLES

788     See sample.config.lua and sample.extend.lua.
789

ENVIRONMENT

791     HOME    User's home directory.
792

SEE ALSO

794     imapfilter(1)
795

BUGS

797     Since version 2.2, a different format is used for the returned structures
798     of the searching methods, due to the introduction of multiple mailbox
799     searching and meta-searching, and thus any configuration files that rely
800     on them should be updated.  Consequently, the processing and fetching
801     methods have been also enhanced and the relevant documentation modified,
802     and while these changes are backwards compatible, an update of the con‐
803     figuration file is still recommended.
804
805     Since version 2.0, the configuration file format has changed.  The new
806     format is not backwards compatible, and thus it should not be mixed with
807     the old format. Nevertheless, configuration files that employ the old,
808     and now deprecated, format can still be read and executed as before.
809

AUTHORS

811     Lefteris Chatzimparmpas <lefcha@hellug.gr>
812
813BSD                            January 23, 2010                            BSD
Impressum