"Fossies" - the Fresh Open Source Software Archive

Member "imapfilter-2.8.2/samples/config.lua" (26 Dec 2023, 3897 Bytes) of package /linux/privat/imapfilter-2.8.2.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Lua source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 ---------------
    2 --  Options  --
    3 ---------------
    4 
    5 options.timeout = 120
    6 options.subscribe = true
    7 
    8 
    9 ----------------
   10 --  Accounts  --
   11 ----------------
   12 
   13 -- Connects to "imap1.mail.server", as user "user1" with "secret1" as
   14 -- password.
   15 account1 = IMAP {
   16     server = 'imap1.mail.server',
   17     username = 'user1',
   18     password = 'secret1',
   19 }
   20 
   21 -- Another account which connects to the mail server using the SSLv3
   22 -- protocol.
   23 account2 = IMAP {
   24     server = 'imap2.mail.server',
   25     username = 'user2',
   26     password = 'secret2',
   27     ssl = 'ssl23',
   28 }
   29 
   30 -- Get a list of the available mailboxes and folders
   31 mailboxes, folders = account1:list_all()
   32 
   33 -- Get a list of the subscribed mailboxes and folders
   34 mailboxes, folders = account1:list_subscribed()
   35 
   36 -- Create a mailbox
   37 account1:create_mailbox('Friends')
   38 
   39 -- Subscribe a mailbox
   40 account1:subscribe_mailbox('Friends')
   41 
   42 
   43 -----------------
   44 --  Mailboxes  --
   45 -----------------
   46 
   47 -- Get the status of a mailbox
   48 account1.INBOX:check_status()
   49 
   50 -- Get all the messages in the mailbox.
   51 results = account1.INBOX:select_all()
   52 
   53 -- Get newly arrived, unread messages
   54 results = account1.INBOX:is_new()
   55 
   56 -- Get unseen messages with the specified "From" header.
   57 results = account1.INBOX:is_unseen() *
   58           account1.INBOX:contain_from('weekly-news@news.letter')
   59 
   60 -- Copy messages between mailboxes at the same account.
   61 results:copy_messages(account1.news)
   62 
   63 -- Get messages with the specified "From" header but without the
   64 -- specified "Subject" header.
   65 results = account1.INBOX:contain_from('announce@my.unix.os') -
   66           account1.INBOX:contain_subject('security advisory')
   67 
   68 -- Copy messages between mailboxes at a different account.
   69 results:copy_messages(account2.security)
   70 
   71 -- Get messages with any of the specified headers.
   72 results = account1.INBOX:contain_from('marketing@company.junk') +
   73           account1.INBOX:contain_from('advertising@annoying.promotion') +
   74           account1.INBOX:contain_subject('new great products')
   75 
   76 -- Delete messages.
   77 results:delete_messages()
   78 
   79 -- Get messages with the specified "Sender" header, which are older than
   80 -- 30 days.
   81 results = account1.INBOX:contain_field('sender', 'owner@announce-list') *
   82           account1.INBOX:is_older(30)
   83 
   84 -- Move messages to the "announce" mailbox inside the "lists" folder.
   85 results:move_messages(account1['lists/announce'])
   86 
   87 -- Get messages, in the "devel" mailbox inside the "lists" folder, with the
   88 -- specified "Subject" header and a size less than 50000 octets (bytes).
   89 results = account1['lists/devel']:contain_subject('[patch]') *
   90           account1['lists/devel']:is_smaller(50000)
   91 
   92 -- Move messages to the "patch" mailbox.
   93 results:move_messages(account2.patch)
   94 
   95 -- Get recent, unseen messages, that have either one of the specified
   96 -- "From" headers, but do not have the specified pattern in the body of
   97 -- the message.
   98 results = ( account1.INBOX:is_recent() *
   99             account1.INBOX:is_unseen() *
  100             ( account1.INBOX:contain_from('tux@penguin.land') +
  101               account1.INBOX:contain_from('beastie@daemon.land') ) ) -
  102           account1.INBOX:match_body('.*all.work.and.no.play.*')
  103 
  104 -- Mark messages as important.
  105 results:mark_flagged()
  106 
  107 -- Get all messages in two mailboxes residing in the same server.
  108 results = account1.news:select_all() +
  109           account1.security:select_all()
  110 
  111 -- Mark messages as seen.
  112 results:mark_seen()
  113 
  114 -- Get recent messages in two mailboxes residing in different servers.
  115 results = account1.INBOX:is_recent() +
  116           account2.INBOX:is_recent()
  117 
  118 -- Flag messages as seen and important.
  119 results:add_flags({ '\\Seen', '\\Flagged' })
  120 
  121 -- Get unseen messages.
  122 results = account1.INBOX:is_unseen()
  123 
  124 -- From the messages that were unseen, match only those with the specified
  125 -- regular expression in the header.
  126 newresults = results:match_header('^.+MailScanner.*Check: [Ss]pam$')
  127 
  128 -- Delete those messages.
  129 newresults:delete_messages()