# # This is a configuration file of imapami. # It is written in YAML. # The full documentation of this configuration file is displayed # with: # imapami --config-help # # Mandatory. # Hostname or IP address of the IMAP server to connect to. server: imap.example.com # Optional. # The TCP port to connect to. If not specified, use the default, # depending on whether SSL is enabled or disabled. # port: 143 # Mandatory. # Enable or disable SSL (True or False). ssl: True # Optional. # IMAP login name. If not specified, the login is asked on stdin. login: user # Optional. # IMAP password. If not specified, the password is asked on stdin. password: cocolasticot # Optional. # File where messages are logged. If not specified, no logs are # written in a file. logfile: imapami.log # Optional. # Level of logs written in logfile. Possible value are from 0 (no log) # to 4 (debug). Default value is 3 (info). # loglevel: 3 # Optional. # Default mailbox directory to get message from. If not specified, # use INBOX. # inbox: INBOX # Any field that is not a reserved keyword is saved as a variable, # and can be reused in rules with {var_name}. me: toto@example.com # List of rules. Each rule is composed of several fields: # - the directory where the rule apply ("inbox"). If not specified, # the default mailbox directory is used. # - a list condition ("if"). All of them must be true to match # the rule. They are all evaluated in the order they appear. # - a list of action ("do"). They are all executed in the order # they appear. # - a list of actions executed when condition does not match # ("else-do") # - a list of actions executed on error when processing an # action list ("on-error-do"). rules: # move some spam in another directory and mark as seen - name: remove spam if: - or: - regexp: {field: X-Spam-Status, pattern: 'Yes'} - regexp: {field: Subject, pattern: '[Vv]iagra'} do: - log: {msg: 'spam:\n Subject: {Subject}\n From: {From}\n To: {To}', level: 4} - seen: {} - move: {dest: Junk} # move mailing list mails in a directory - name: mailing list foo if: - regexp: {field: Subject, pattern: '\[foo\]'} do: - set-var: {ml: yes} - move: {dest: foo} # log if at least one ml message was processed - name: log if some mailing list messages if: - eq: ['{ml}', 'yes'] do: - log: {msg: 'some messages for mailing list'} # pipe automation tasks to a script and mark as seen - name: automation if: - regexp: {field: Subject, pattern: '\[auto\]'} do: - pipe: {command: '/usr/bin/my-prog'} - seen: {} # move mail whose To or Cc is me into another directory - name: urgent mails if: - or: - to: {substr: '{me}'} - cc: {substr: '{me}'} do: - move: {dest: urgent}