File: sample.config.lua

package info (click to toggle)
imapfilter 1%3A1.2.2-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 300 kB
  • ctags: 315
  • sloc: ansic: 3,392; sh: 182; makefile: 103
file content (126 lines) | stat: -rw-r--r-- 3,373 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
---------------
--  Options  --
---------------

options.timeout = 120
options.subscribe = true


----------------
--  Accounts  --
----------------

-- Connects to "imap1.mail.server", as user "user1" with "secret1" as password.
account1 = {
    server = 'imap1.mail.server',
    username = 'user1',
    password = 'secret1',
}

-- Another account which connects to the mail server using the SSLv3 protocol.
account2 = {
    server = 'imap2.mail.server',
    username = 'user2',
    password = 'secret2',
    ssl = 'ssl3',
}


---------------
--  Filters  --
---------------

-- The simplest filter that is possible. Matches all messages in the mailbox.
all = {}

-- A simple filter with just one rule.  Matches newly arrived, unread messages.
simple = {
    'new',
}

-- Another simple filter with two rules.  Matches unseen messages with the
-- specified "From" header.
weeklynews = {
    'unseen',
    'from "weekly-news@news.letter"',
}

-- A filter with the negation operator.  Matches messages with the specified
-- "From" header but without the specified "Subject" header.
security = {
    'from "announce@my.unix.os"',
    'not subject "security advisory"',
}

-- A filter with "inverted" AND/OR logic.  Matches messages with _any_ of the
-- specified headers.
unwanted = {
    invert = true,
    'from "marketing@company.junk"',
    'from "advertising@annoying.promotion"',
    'subject "new great products"',
}

-- A filter which considers the message's size.  Matches messages with the
-- specified "Subject" header and a size less than 50000 octets (bytes).
patch = {
    'subject "[patch]"',
    'smaller 50000',
}

-- A filter which considers the message's internal date.  Matches messages with
-- the specified "Sender" header, which have arrived in the mailbox after
-- 01/01/2004.
maillist = {
     'header "sender" "owner@maillist.server"',
     'since 01-Jan-2004',
}


-- A more complicated filter.  Matches recent, unseen messages, that have
-- either one of the specified "From" headers, but do not have the specified
-- phrase in the body of the message.
workplay = {
    'recent',
    'unseen',
    { 'from "tux@penguin.land"', 'from "beastie@daemon.land"' },
    'not body "all work and no play"',
}


----------------
--  Commands  --
----------------

-- Get status (messages, recent, unseen) of the mailbox.
check(account1, 'INBOX')

-- Copy messages between mailboxes at the same account.
results = match(account1, 'INBOX', weeklynews)
copy(account1, 'INBOX', account1, 'news', results)

-- Copy messages between mailboxes at a different account.
results = match(account1, 'INBOX', patch)
copy(account1, 'INBOX', account2, 'patch', results)

-- Move messages between mailboxes at the same account.
results = match(account1, 'INBOX', maillist)
move(account1, 'INBOX', account1, 'list', results)

-- Move messages between mailboxes at a different account.
results = match(account1, 'INBOX', security)
move(account1, 'INBOX', account2, 'INBOX', results)

-- Delete messages.
results = match(account1, 'INBOX', unwanted)
delete(account1, 'INBOX', results)

-- Flag messages.
results = match(account1, 'INBOX', workplay)
flag(account1, 'INBOX', 'add', { 'seen' }, results)

-- List available mailboxes and folders.
mailboxes, folders = list(account1, '')

-- List available subscribed mailboxes and folders.
mailboxes, folders = lsub(account1, '')