imapfilter_config.5 (imapfilter-2.7.5) | : | imapfilter_config.5 (imapfilter-2.7.6) | ||
---|---|---|---|---|
IMAPFILTER_CONFIG(5) BSD File Formats Manual IMAPFILTER_CONFIG(5) | IMAPFILTER_CONFIG(5) BSD File Formats Manual IMAPFILTER_CONFIG(5) | |||
NAME | NAME | |||
imapfilter_config — imapfilter configuration file | imapfilter_config — imapfilter configuration file | |||
SYNOPSIS | SYNOPSIS | |||
$HOME/.imapfilter/config.lua | $HOME/.imapfilter/config.lua | |||
DESCRIPTION | DESCRIPTION | |||
imapfilter(1) uses the Lua programming language as a configuration and exte nsion language, therefore the | imapfilter(1) uses the Lua programming language as a configuration and exte nsion language, therefore, the | |||
configuration file is a Lua script. | configuration file is a Lua script. | |||
Although knowledge of Lua is not required to use imapfilter(1), it is nonet heless recommended, especially if | Although knowledge of Lua is not required to use imapfilter(1), it is nonet heless recommended, especially if | |||
one wants to extend it. For more information on Lua see http://www.lua.org /docs.html. | one wants to extend it. For more information on Lua see http://www.lua.org/ docs.html. | |||
CONVENTIONS | CONVENTIONS | |||
A brief description of the Lua values and types mentioned hereafter in the manual page follows: | A brief description of the Lua values and types mentioned hereafter in the manual page follows: | |||
The nil is the type of the value “nil”, whose main property is to be di fferent from any other value; | The nil is the type of the value “nil”, whose main property is to be di fferent from any other value; | |||
usually it represents the absence of a useful value. | usually it represents the absence of a useful value. | |||
The boolean is the type of the values “true” and “false”. Both “nil” a nd “false” make a condition | The boolean is the type of the values “true” and “false”. Both “nil” a nd “false” make a condition | |||
false; any other value makes it true. | false; any other value makes it true. | |||
skipping to change at line 50 | skipping to change at line 50 | |||
options.namespace = false | options.namespace = false | |||
options.charset = 'ISO-8859-1' | options.charset = 'ISO-8859-1' | |||
Available options are: | Available options are: | |||
cache When this option is enabled, parts of messages are cached locally i n memory to avoid being down- | cache When this option is enabled, parts of messages are cached locally i n memory to avoid being down- | |||
loaded more than once. The cache is preserved for the current sess ion only. This variable takes a | loaded more than once. The cache is preserved for the current sess ion only. This variable takes a | |||
boolean as a value. Default is “true”. | boolean as a value. Default is “true”. | |||
certificates | certificates | |||
When this option is enabled, the server certificate can be accepted | When this option is enabled, the server certificate can be accepted | |||
and stored, in order to validate | and stored, to validate the | |||
the authenticity of the server in future connections. This variable | authenticity of the server in future connections. This variable tak | |||
takes a boolean as a value. | es a boolean as a value. Default | |||
Default is “true”. | is “true”. | |||
charset | charset | |||
Indicates to the server the character set of the strings for the se arching methods. This variable | Indicates to the server the character set of the strings for the se arching methods. This variable | |||
takes a string as a value. By default no character set is set, and thus plain ASCII should be | takes a string as a value. By default, no character set is set, an d thus plain ASCII should be | |||
assumed by the server. | assumed by the server. | |||
create According to the IMAP specification, when trying to write a message to a non-existent mailbox, the | create According to the IMAP specification, when trying to write a message to a non-existent mailbox, the | |||
server must send a hint to the client, whether it should create the mailbox and try again or not. | server must send a hint to the client, whether it should create the mailbox and try again or not. | |||
However some IMAP servers don't follow the specification and don't | However, some IMAP servers don't follow the specification and don't | |||
send the correct response code to | send the correct response code | |||
the client. By enabling this option the client tries to create the | to the client. By enabling this option the client tries to create t | |||
mailbox, despite of the server's | he mailbox, despite of the | |||
response. This variable takes a boolean as a value. Default is “fa | server's response. This variable takes a boolean as a value. Defau | |||
lse”. | lt is “false”. | |||
close This option controls whether the currently selected mailbox is impl icitly closed at the end of each | close This option controls whether the currently selected mailbox is impl icitly closed at the end of each | |||
performed operation, thus removing all messages that are marked del eted. This variable takes a | performed operation, thus removing all messages that are marked del eted. This variable takes a | |||
boolean as a value. Default is “false”. | boolean as a value. Default is “false”. | |||
crammd5 | ||||
When this option is enabled and the server supports the Challenge-R | ||||
esponse Authentication Mechanism | ||||
(specifically CRAM-MD5), this method will be used for user authenti | ||||
cation instead of a plaintext | ||||
password LOGIN. This variable takes a boolean as a value. Default | ||||
is “true”. | ||||
expunge | expunge | |||
Normally, messages are marked for deletion and are actually deleted when the mailbox is closed. | Normally, messages are marked for deletion and are actually deleted when the mailbox is closed. | |||
When this option is enabled, messages are expunged immediately afte r being marked deleted. This | When this option is enabled, messages are expunged immediately afte r being marked deleted. This | |||
variable takes a boolean as a value. Default is “true”. | variable takes a boolean as a value. Default is “true”. | |||
hostnames | hostnames | |||
When this option is enabled, the server hostname is validated, in o rder to verify the client is | When this option is enabled, the server hostname is validated, in o rder to verify the client is | |||
talking to the correct server. This variable takes a boolean as a v alue. Default is “true”. | talking to the correct server. This variable takes a boolean as a v alue. Default is “true”. | |||
info When this options is enabled, a summary of the program's actions is printed, while processing mail- | info When this option is enabled, a summary of the program's actions is printed, while processing mail- | |||
boxes. This variable takes a boolean as a value. Default is “true ”. | boxes. This variable takes a boolean as a value. Default is “true ”. | |||
keepalive | keepalive | |||
The time in minutes before terminating and re-issuing the IDLE comm and, in order to keep alive the | The time in minutes before terminating and re-issuing the IDLE comm and, in order to keep alive the | |||
connection, by resetting the inactivity timeout of the server. A s tandards compliant server must | connection, by resetting the inactivity timeout of the server. A s tandards compliant server must | |||
have an inactivity timeout of at least 30 minutes. But it may happ | have an inactivity timeout of at least 30 minutes. But some IMAP s | |||
en that some IMAP servers don't | ervers might not respect that, or | |||
respect that, or some intermediary network device has a shorter tim | some intermediary network device has a shorter timeout. By setting | |||
eout. By setting this option the | this option the above problem | |||
above problem can be worked around. This variable takes a number as | can be worked around. This variable takes a number as a value. Defa | |||
a value. Default is “29” min- | ult is “29” minutes. | |||
utes. | ||||
limit Some servers have problems handling very long requests, but some of the requests that need to be | limit Some servers have problems handling very long requests, but some of the requests that need to be | |||
sent can become quite long, because they apply an action for many m | sent can become quite long because they apply an action for many me | |||
essages at once. When this | ssages at once. When this option | |||
option is set, the client will try to break up these requests into | is set, the client will try to break up these requests into smaller | |||
smaller requests, that each oper- | requests, that each operates on | |||
ates on fewer messages at a time. A good value for this would be “ | fewer messages at a time. A good value for this would be “50”. Th | |||
50”. This variable takes a | is variable takes a number as a | |||
number as a value. Default is “0”. See also the range option whic | value. Default is “0”. See also the range option which is related | |||
h is related. | . | |||
namespace | namespace | |||
When enabled, the program gets the namespace of the user's personal mailboxes, and applies automati- | When enabled, the program gets the namespace of the user's personal mailboxes, and applies automati- | |||
cally the prefix and hierarchy delimiter to any mailboxes residing on the mail server; the user must | cally the prefix and hierarchy delimiter to any mailboxes residing on the mail server; the user must | |||
use the ‘/’ character as the delimiter and “” (ie. nothing) as the | use the ‘/’ character as the delimiter and “” (i.e. nothing) as th | |||
prefix, regardless of the folder | e prefix, regardless of the | |||
format of the mail server. This must be disabled, if the user want | folder format of the mail server. This must be disabled, if the us | |||
s to manually specify mailbox | er wants to manually specify | |||
names (eg. because they are not part of the user's personal namespa | mailbox names (e.g. because they are not part of the user's persona | |||
ce mailboxes). This variable | l namespace mailboxes). This | |||
takes a boolean as a value. Default is “true”. | variable takes a boolean as a value. Default is “true”. | |||
persist | persist | |||
When the recover option is enabled, the recovery function tries to restore the lost session, but if | When the recover option is enabled, the recovery function tries to restore the lost session, but if | |||
it fails to do so it gives up with an error. In some cases a tempo | it fails to do so, it gives up with an error. In some cases, a tem | |||
rary network problem might cause | porary network problem might | |||
the recovery function to fail, but the connection could be reestabl | cause the recovery function to fail, but the connection could be re | |||
ished when trying a bit later. | established when trying a bit | |||
By enabling this option, the recovery function will be called repea | later. By enabling this option, the recovery function will be call | |||
tedly after a timeout, thus it | ed repeatedly after a timeout, | |||
will persist when trying to restore the session. Note, that this w | thus it will persist when trying to restore the session. Note, tha | |||
ill case the execution of the | t this will cause the execution | |||
configuration file to be halted at the point of failure until the s | of the configuration file to be halted at the point of failure unti | |||
ession is restored, which can | l the session is restored, which | |||
have side effects to other established sessions, for example they m | can have side effects to other established sessions, for example, t | |||
ight get dropped by the server | hey might get dropped by the | |||
after a while. This variable takes a boolean as a value. Default | server after a while. This variable takes a boolean as a value. D | |||
is “false”. | efault is “false”. | |||
range Some servers have problems handling long sequence number ranges, an d by setting this option, the | range Some servers have problems handling long sequence number ranges, an d by setting this option, the | |||
number of messages included in each range can be limited. A good v alue for this would be “50”. | number of messages included in each range can be limited. A good v alue for this would be “50”. | |||
This variable takes a number as a value. By default no such limit is imposed. See also the limit | This variable takes a number as a value. By default, no such limit is imposed. See also the limit | |||
option which is related. | option which is related. | |||
recover | recover | |||
With this option it is possible to control the recovery functionali | With this option, it is possible to control the recovery functional | |||
ty, which restores a session (the | ity, which restores a session | |||
connection to the server and the IMAP state at the time), after som | (the connection to the server and the IMAP state at the time), afte | |||
e unexpected event takes place. | r some unexpected event takes | |||
Currently there are two types of events that can end abnormally a s | place. Currently, there are two types of events that can end abnor | |||
ession, and finally cause the | mally a session, and finally | |||
program to terminate: network errors, and the IMAP BYE response whi | cause the program to terminate: network errors, and the IMAP BYE re | |||
ch a server can send anytime. | sponse which a server can send | |||
When this option is set to “all” the recovery function is triggered | anytime. When this option is set to “all” the recovery function is | |||
by both types of events, when | triggered by both types of | |||
set to “errors” only in the case of network errors, and when set to | events, when set to “errors” only in the case of network errors, an | |||
“none” the mechanism is com- | d when set to “none” the mecha- | |||
pletely disabled. Default is “all”. | nism is completely disabled. Default is “all”. | |||
reenter | reenter | |||
When this option is enabled and the connection is recovered after s ome unexpected event while in | When this option is enabled and the connection is recovered after s ome unexpected event while in | |||
IDLE mode (see also the recover option), the client will re-enter I DLE mode. But when this option | IDLE mode (see also the recover option), the client will re-enter I DLE mode. But when this option | |||
is disabled, and after the connection is recovered, the client will not re-enter IDLE mode, and | is disabled, and after the connection is recovered, the client will not re-enter IDLE mode, and | |||
instead will continue to execute the next line in the configuration file, ie. the one after | instead will continue to execute the next line in the configuration file, i.e. the one after | |||
enter_idle(). Default is “true”. | enter_idle(). Default is “true”. | |||
starttls | starttls | |||
When this option is enabled and the server supports the IMAP STARTT LS extension, a TLS connection | When this option is enabled and the server supports the IMAP STARTT LS extension, a TLS connection | |||
will be negotiated with the mail server in the beginning of the ses sion. This variable takes a | will be negotiated with the mail server in the beginning of the ses sion. This variable takes a | |||
boolean as value. Default is “true”. | boolean as value. Default is “true”. | |||
subscribe | subscribe | |||
By enabling this option new mailboxes that were automatically creat ed, get also subscribed; they are | By enabling this option new mailboxes that were automatically creat ed, get also subscribed; they are | |||
set active in order for IMAP clients to recognize them. This varia ble takes a boolean as a value. | set active in order for IMAP clients to recognize them. This varia ble takes a boolean as a value. | |||
Default is “false”. | Default is “false”. | |||
timeout | timeout | |||
The time in seconds for the program to wait for a mail server's res ponse. If set to 0, the client | The time in seconds for the program to wait for a mail server's res ponse. If set to 0, the client | |||
will block indefinitely. This variable takes a number as a value. Default is “60” seconds. | will block indefinitely. This variable takes a number as a value. Default is “60” seconds. | |||
wakeonany | wakeonany | |||
By enabling this option the IDLE command will return on any event t hat is received from the server, | By enabling this option, the IDLE command will return on any event that is received from the server, | |||
and not just on the “RECENT” and “EXISTS” events, that normally ind icate the arrival of a new mes- | and not just on the “RECENT” and “EXISTS” events, that normally ind icate the arrival of a new mes- | |||
sage. Examples of other events are “FETCH”, which indicates that t he details of a message (eg. its | sage. Examples of other events are “FETCH”, which indicates that t he details of a message (e.g. its | |||
flags) have been modified, or “EXPUNGE”, which indicates that a mes sage has been deleted. This | flags) have been modified, or “EXPUNGE”, which indicates that a mes sage has been deleted. This | |||
variable takes a boolean as a value. Default is “false”. | variable takes a boolean as a value. Default is “false”. | |||
ACCOUNTS | ACCOUNTS | |||
Accounts are initialized using the IMAP() function, and the details of the connection are defined using an | Accounts are initialized using the IMAP() function, and the details of the connection are defined using an | |||
account table: | account table: | |||
myaccount = IMAP { | myaccount = IMAP { | |||
server = 'imap.mail.server', | server = 'imap.mail.server', | |||
username = 'me', | username = 'me', | |||
skipping to change at line 181 | skipping to change at line 175 | |||
An account table must have the following elements: | An account table must have the following elements: | |||
server The hostname of the IMAP server to connect to. It takes a string a s a value. | server The hostname of the IMAP server to connect to. It takes a string a s a value. | |||
username | username | |||
User's name. It takes a string as a value. | User's name. It takes a string as a value. | |||
An account table can also have the following optional elements: | An account table can also have the following optional elements: | |||
password | password | |||
User's secret keyword. If a password wasn't supplied the user will be asked to enter one interac- | User's secret keyword. If a password wasn't supplied, the user wil l be asked to enter one interac- | |||
tively the first time it will be needed (unless oauth2 has been set ). It takes a string as a value. | tively the first time it will be needed (unless oauth2 has been set ). It takes a string as a value. | |||
Passwords can also be extracted during execution time from an encry | ||||
pted password vault. The | ||||
samples/extend.lua file contains such an example. | ||||
Note that due to Lua using backslash ‘\’ as an escape character for its strings, one has to use dou- | Note that due to Lua using backslash ‘\’ as an escape character for its strings, one has to use dou- | |||
ble backslashes in order to insert a single backslash, and thus a b ackslash character inside a pass- | ble backslashes in order to insert a single backslash, and thus a b ackslash character inside a pass- | |||
word might require four backslashes. | word might require four backslashes. | |||
oauth2 The OAuth2 string to use to authenticate if the server supports the XOAUTH2 authentication mecha- | oauth2 The OAuth2 string to use to authenticate if the server supports the XOAUTH2 authentication mecha- | |||
nism. If the server does not support it and a password has been al so set, authentication will be | nism. If the server does not support it and a password has also be en set, authentication will be | |||
attempted using the password. It takes a string as a value. | attempted using the password. It takes a string as a value. | |||
Note that this requires that an OAuth client ID and client secret h ave been obtained, an OAuth2 | Note that this requires that an OAuth client ID and client secret h ave been obtained, an OAuth2 | |||
token has been generated and authorized, a new access token has bee n generated using the refresh | token has been generated and authorized, a new access token has bee n generated using the refresh | |||
token if the last access token has expired, and an OAuth2 string ha s been generated from the access | token if the last access token has expired, and an OAuth2 string ha s been generated from the access | |||
token. The aforementioned OAuth2 string is a Base64 encoded string that should be set here. For | token. The aforementioned OAuth2 string is a Base64 encoded string that should be set here. For | |||
more information see https://developers.google.com/gmail/xoauth2_pr | more information, see https://developers.google.com/gmail/xoauth2_p | |||
otocol. | rotocol. | |||
The samples/extend.lua file contains an example of authentication u | ||||
sing OAuth2. | ||||
port The port to connect to. It takes a number as a value. Default is “143” for imap and “993” for | port The port to connect to. It takes a number as a value. Default is “143” for imap and “993” for | |||
imaps. | imaps. | |||
ssl Forces an imaps connection and specifies the SSL/TLS protocol/versi on to be used. It takes a string | ssl Forces an imaps connection and specifies the SSL/TLS protocol/versi on to be used. It takes a string | |||
as a value, specifically one of: “auto”, “tls1.2”, “tls1.1”, “tls1” , “ssl3”. | as a value, specifically one of: “auto”, “tls1.2”, “tls1.1”, “tls1” , “ssl3”. | |||
Note that the latest versions of the OpenSSL library have deprecate d version specific methods, and | Note that the latest versions of the OpenSSL library have deprecate d version specific methods, and | |||
the actual protocol version used will be negotiated to be the highe st version mutually supported by | the actual protocol version used, will be negotiated to be the high est version mutually supported by | |||
the client and the server. This is also what the “auto” value does . | the client and the server. This is also what the “auto” value does . | |||
LISTING | LISTING | |||
The following methods can be used on an account to list mailboxes in a fold er of an account: | The following methods can be used on an account to list mailboxes in a fold er of an account: | |||
list_all(folder) | list_all(folder) | |||
Lists all the available mailboxes in the folder (string), and retur ns a table that contains strings, | Lists all the available mailboxes in the folder (string), and retur ns a table that contains strings, | |||
the available mailboxes, and a table that contains strings, the ava ilable folders. | the available mailboxes, and a table that contains strings, the ava ilable folders. | |||
list_subscribed(folder) | list_subscribed(folder) | |||
Lists all the subscribed mailboxes in the folder (string), and retu rns a table that contains | Lists all the subscribed mailboxes in the folder (string), and retu rns a table that contains | |||
strings, the subscribed mailboxes, and a table that contains string s, the subscribed folders. | strings, the subscribed mailboxes, and a table that contains string s, the subscribed folders. | |||
The following methods can be used on an account to list mailboxes, using wi ldcards, in a folder of an | The following methods can be used on an account to list mailboxes, using wi ldcards, in a folder of an | |||
account. The ‘*’ wildcard, matches any character and the ‘%’ matches any c haracter except the folder delim- | account. The ‘*’ wildcard, matches any character and the ‘%’ matches any c haracter except the folder delim- | |||
iter, ie. non-recursively: | iter, i.e. non-recursively: | |||
list_all(folder, mailbox) | list_all(folder, mailbox) | |||
Lists all the available mailboxes in the folder (string) with the n ame mailbox (string), and returns | Lists all the available mailboxes in the folder (string) with the n ame mailbox (string), and returns | |||
a table that contains strings, the available mailboxes, and a table that contains strings, the | a table that contains strings, the available mailboxes, and a table that contains strings, the | |||
available folders. Wildcards may only be used in the mailbox argum ent. | available folders. Wildcards may only be used in the mailbox argum ent. | |||
list_subscribed(folder, mailbox) | list_subscribed(folder, mailbox) | |||
Lists all the subscribed mailboxes in the folder (string) with the name mailbox (string), and | Lists all the subscribed mailboxes in the folder (string) with the name mailbox (string), and | |||
returns a table that contains strings, the subscribed mailboxes, an d a table that contains strings, | returns a table that contains strings, the subscribed mailboxes, an d a table that contains strings, | |||
the subscribed folders. Wildcards may only be used in the mailbox argument. | the subscribed folders. Wildcards may only be used in the mailbox argument. | |||
skipping to change at line 278 | skipping to change at line 277 | |||
If mailbox names don't only include letters, digits and underscores, or beg in with a digit, an alternative | If mailbox names don't only include letters, digits and underscores, or beg in with a digit, an alternative | |||
form must be used: | form must be used: | |||
myaccount['mymailbox'] | myaccount['mymailbox'] | |||
A mailbox inside a folder can be only accessed by using the alternative for m: | A mailbox inside a folder can be only accessed by using the alternative for m: | |||
myaccount['myfolder/mymailbox'] | myaccount['myfolder/mymailbox'] | |||
The methods that are available for an account (eg. list_all(), create_mail box(), etc.) , are considered | The methods that are available for an account (e.g. list_all(), create_mai lbox(), etc.) , are considered | |||
keywords and must not be used as mailbox names, and the same also applies f or any string starting with an | keywords and must not be used as mailbox names, and the same also applies f or any string starting with an | |||
underscore, as they are considered reserved. | underscore, as they are considered reserved. | |||
CHECKING | CHECKING | |||
The following methods can be used to check the status of a mailbox: | The following methods can be used to check the status of a mailbox: | |||
check_status() | check_status() | |||
The check_status() method gets the current status of a mailbox, and returns four values of number | The check_status() method gets the current status of a mailbox, and returns four values of number | |||
type: the total number of messages, the number of recent messages, the number of unseen messages in | type: the total number of messages, the number of recent messages, the number of unseen messages in | |||
the mailbox, and the next UID to be assigned to a new message in th e mailbox. | the mailbox, and the next UID to be assigned to a new message in th e mailbox. | |||
enter_idle() | enter_idle() | |||
The enter_idle() method implements the IMAP IDLE (RFC 2177) extensi on. By using this extension it's | The enter_idle() method implements the IMAP IDLE (RFC 2177) extensi on. By using this extension it's | |||
not necessary to poll the server for changes to the selected mailbo | not necessary to poll the server for changes to the selected mailbo | |||
x (ie. using the check_status() | x (i.e. using the check_status() | |||
method), but instead the server sends an update when there is a cha | method), but instead the server sends an update when there is a cha | |||
nge in the mailbox (eg. in case | nge in the mailbox (e.g. in case | |||
of new mail). When the enter_idle() method has been called no more commands in the configuration | of new mail). When the enter_idle() method has been called no more commands in the configuration | |||
file are executed until an update is received, at which point the e nter_idle() method returns. For | file are executed until an update is received, at which point the e nter_idle() method returns. For | |||
the enter_idle() to work, the IDLE extension has to be supported by the IMAP server. | the enter_idle() to work, the IDLE extension has to be supported by the IMAP server. | |||
The enter_idle() method returns a value of type boolean: “true” if the IDLE extension is supported | The enter_idle() method returns a value of type boolean: “true” if the IDLE extension is supported | |||
and there was a update in the mailbox, and “false” if the IDLE exte nsion is not supported, in which | and there was an update in the mailbox, and “false” if the IDLE ext ension is not supported, in which | |||
case the method returns immediately. When the aforementioned retur n value was “true”, an additional | case the method returns immediately. When the aforementioned retur n value was “true”, an additional | |||
second value of type string is also returned, indicating the event received from the server, which | second value of type string is also returned, indicating the event received from the server, which | |||
is useful when the wakeonany option has been enabled. | is useful when the wakeonany option has been enabled. | |||
Apart from an event received by the server, the SIGUSR1 or SIGUSR2 signals can also interrupt the | Apart from an event received by the server, the SIGUSR1 or SIGUSR2 signals can also interrupt the | |||
IDLE mode at any time, and the execution of the configuration file will then continue from the next | IDLE mode at any time, and the execution of the configuration file will then continue from the next | |||
line after the enter_idle(). In this case only the value “true” is returned. | line after the enter_idle(). In this case, only the value “true” i s returned. | |||
Examples: | Examples: | |||
exist, unread, unseen, uidnext = myaccount.mymailbox:check_status() | exist, unread, unseen, uidnext = myaccount.mymailbox:check_status() | |||
update = myaccount.mymailbox:enter_idle() | update = myaccount.mymailbox:enter_idle() | |||
update, event = myaccount.mymailbox:enter_idle() | update, event = myaccount.mymailbox:enter_idle() | |||
SEARCHING | SEARCHING | |||
The searching methods in this subsection can be applied to any mailbox. Th ey return a special form of | The searching methods in this subsection can be applied to any mailbox. Th ey return a special form of | |||
table, that contains the messages that match the searching method. This ta ble can be combined with other | table, that contains the messages that match the searching method. This ta ble can be combined with other | |||
skipping to change at line 350 | skipping to change at line 349 | |||
results = myaccount.mymailbox:is_unseen() + | results = myaccount.mymailbox:is_unseen() + | |||
myaccount.mymailbox:is_larger(100000) * | myaccount.mymailbox:is_larger(100000) * | |||
myaccount.mymailbox:contain_subject('test') | myaccount.mymailbox:contain_subject('test') | |||
results = ( myaccount.mymailbox:is_unseen() + | results = ( myaccount.mymailbox:is_unseen() + | |||
myaccount.mymailbox:is_larger(100000) ) * | myaccount.mymailbox:is_larger(100000) ) * | |||
myaccount.mymailbox:contain_subject('test') | myaccount.mymailbox:contain_subject('test') | |||
The returned tables of the searching methods can also be stored in variable s and then further processed: | The returned tables of the searching methods can also be stored in variable s and then further processed: | |||
unseen = myaccount.myaccount:is_unseen() | unseen = myaccount.mymailbox:is_unseen() | |||
larger = myaccount.mymailbox:is_larger(100000) | larger = myaccount.mymailbox:is_larger(100000) | |||
subject = myaccount.mymailbox:contain_subject('test') | subject = myaccount.mymailbox:contain_subject('test') | |||
results = unseen + larger * subject | results = unseen + larger * subject | |||
A composite filter that includes one or more simple rules can be defined: | A composite filter that includes one or more simple rules can be defined: | |||
myfilter = function () | myfilter = function () | |||
return myaccount.mymailbox:is_unseen() + | return myaccount.mymailbox:is_unseen() + | |||
myaccount.mymailbox:is_larger(100000) * | myaccount.mymailbox:is_larger(100000) * | |||
myaccount.mymailbox:contain_subject('test') | myaccount.mymailbox:contain_subject('test') | |||
skipping to change at line 472 | skipping to change at line 471 | |||
is_newer(age) | is_newer(age) | |||
Messages that are newer than the age (number) in days. | Messages that are newer than the age (number) in days. | |||
is_older(age) | is_older(age) | |||
Messages that are older than the age (number) in days. | Messages that are older than the age (number) in days. | |||
The following methods can be used to search for messages based on their arr ival or sent date, in the | The following methods can be used to search for messages based on their arr ival or sent date, in the | |||
“day-month-year” form, where day is the day of the month as a decimal numbe r (01-31), month is the abbrevi- | “day-month-year” form, where day is the day of the month as a decimal numbe r (01-31), month is the abbrevi- | |||
ated month ( “Jan”, “Feb”, “Mar”, “Apr”, “May”, “Jun”, “Jul”, “Aug”, “Sep”, “Oct”, “Nov”, “Dec”) and year is | ated month ( “Jan”, “Feb”, “Mar”, “Apr”, “May”, “Jun”, “Jul”, “Aug”, “Sep”, “Oct”, “Nov”, “Dec”) and year is | |||
the year as decimal number including the century (eg. 2007): | the year as decimal number including the century (e.g. 2007): | |||
arrived_before(date) | arrived_before(date) | |||
messages that have arrived earlier than the date (string), where da te is in the “day-month-year” | messages that have arrived earlier than the date (string), where da te is in the “day-month-year” | |||
form. | form. | |||
arrived_on(date) | arrived_on(date) | |||
Messages that have arrived within the date (string), where date is in the “day-month-year” form. | Messages that have arrived within the date (string), where date is in the “day-month-year” form. | |||
arrived_since(date) | arrived_since(date) | |||
Messages that have arrived within or later than the date (string), where date is in the | Messages that have arrived within or later than the date (string), where date is in the | |||
skipping to change at line 654 | skipping to change at line 653 | |||
unmark_draft() | unmark_draft() | |||
Unmarks the messages that have been marked as draft. | Unmarks the messages that have been marked as draft. | |||
unmark_flagged() | unmark_flagged() | |||
Unmarks the messages that have been marked for urgent/special atten tion. | Unmarks the messages that have been marked for urgent/special atten tion. | |||
unmark_seen() | unmark_seen() | |||
Unmarks the messages that have been marked as read. | Unmarks the messages that have been marked as read. | |||
The following methods can be used to flag messages in a mailbox. The standa rd system flags are “\Answered”, | The following methods can be used to flag messages in a mailbox. The standa rd system flags are “\Answered”, | |||
“\Deleted”, “\Draft”, “\Flagged”, “\Seen”, while if the server supports it, new user keywords may be | “\Deleted”, “\Draft”, “\Flagged”, “\Seen”, while, if the server supports it , new user keywords may be | |||
defined: | defined: | |||
add_flags(flags) | add_flags(flags) | |||
Adds the flags (table that contains strings) to the messages. | Adds the flags (table that contains strings) to the messages. | |||
remove_flags(flags) | remove_flags(flags) | |||
Removes the flags (table that contains strings) from the messages. | Removes the flags (table that contains strings) from the messages. | |||
replace_flags(flags) | replace_flags(flags) | |||
Replaces the flags (table that contains strings) of the messages. | Replaces the flags (table that contains strings) of the messages. | |||
skipping to change at line 679 | skipping to change at line 678 | |||
results:copy_messages(myaccount.myothermailbox) | results:copy_messages(myaccount.myothermailbox) | |||
results:move_messages(myotheraccount.mymailbox) | results:move_messages(myotheraccount.mymailbox) | |||
results:mark_seen() | results:mark_seen() | |||
results:unmark_flagged() | results:unmark_flagged() | |||
results:add_flags({ 'MyFlag', '\\Seen' }) | results:add_flags({ 'MyFlag', '\\Seen' }) | |||
results:remove_flags({ '\\Seen' }) | results:remove_flags({ '\\Seen' }) | |||
results:move_messages(myotheraccount['myfolder/mymailbox']) | results:move_messages(myotheraccount['myfolder/mymailbox']) | |||
MESSAGES | MESSAGES | |||
The messages that are residing in any mailbox can be also accessed, as a wh ole or in parts. Messages can be | The messages that are residing in any mailbox can also be accessed, as a wh ole or in parts. Messages can be | |||
accessed using their unique identifier (UID): | accessed using their unique identifier (UID): | |||
myaccount.mymailbox[22] | myaccount.mymailbox[22] | |||
The UIDs of messages the user is interested in, are gained from the results of searching: | The UIDs of messages the user is interested in, are gained from the results of searching: | |||
results = account.INBOX:is_unseen() | results = account.INBOX:is_unseen() | |||
for _, message in ipairs(results) do | for _, message in ipairs(results) do | |||
mailbox, uid = table.unpack(message) | mailbox, uid = table.unpack(message) | |||
header = mailbox[uid]:fetch_header() | header = mailbox[uid]:fetch_header() | |||
skipping to change at line 790 | skipping to change at line 789 | |||
the child process. | the child process. | |||
regex_search(pattern, string) | regex_search(pattern, string) | |||
Implements Perl-compatible regular expressions (PCRE). The pattern (string) is a PCRE pattern. The | Implements Perl-compatible regular expressions (PCRE). The pattern (string) is a PCRE pattern. The | |||
string (string) is the subject string in which the pattern is match ed against. Returns at least a | string (string) is the subject string in which the pattern is match ed against. Returns at least a | |||
boolean, that denotes if the match was successful, and any captures which are of string type. Note | boolean, that denotes if the match was successful, and any captures which are of string type. Note | |||
that due to Lua using backslash ‘\’ as an escape character for its strings, one has to use double | that due to Lua using backslash ‘\’ as an escape character for its strings, one has to use double | |||
backslashes in order to insert a single backslash inside a regular expression pattern. For more | backslashes in order to insert a single backslash inside a regular expression pattern. For more | |||
information on PCRE see http://pcre.org/original/doc/html/. | information on PCRE see http://pcre.org/original/doc/html/. | |||
sleep(interval) | ||||
Delay for the specified interval (number) in seconds. | ||||
Examples: | Examples: | |||
date = form_date(14) | date = form_date(14) | |||
password = get_password('Enter password: ') | password = get_password('Enter password: ') | |||
become_daemon(600, myfunction) | become_daemon(600, myfunction) | |||
status = pipe_to('mycommandline', 'mydata') | status = pipe_to('mycommandline', 'mydata') | |||
status, data = pipe_from('mycommandline') | status, data = pipe_from('mycommandline') | |||
success, capture = regex_search('^(?i)pcre: (\\w)$', 'mystring') | success, capture = regex_search('^(?i)pcre: (\\w)$', 'mystring') | |||
sleep(300) | ||||
For more examples, see the samples/extend.lua file. | ||||
EXAMPLES | EXAMPLES | |||
See samples/config.lua and samples/extend.lua in the source code distributi on. | See samples/config.lua and samples/extend.lua in the source code distributi on. | |||
ENVIRONMENT | ENVIRONMENT | |||
HOME User's home directory. | HOME User's home directory. | |||
SEE ALSO | SEE ALSO | |||
imapfilter(1) | imapfilter(1) | |||
BSD Dec 5, 2020 BSD | BSD Jul 8, 2022 BSD | |||
End of changes. 33 change blocks. | ||||
93 lines changed or deleted | 97 lines changed or added |