Script to archive emails from one imap account to another. Intended to be able to add other backends
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

108 lines
3.1 KiB

##
# Source of mail to be archived
#
# type: type of email storage, only supported format is imap. Following
# attributes are those of an imap account, could be different for other storage types.
#
# server : address of imap server
# port : port if not default (default is 993 if tls_mode = direct, else 143)
# tls_mode : none : no tls at all (should be reserved to debug)
# direct : direct TLS as in imaps
# starttls : normal connect then starttls command, fails if starttls
# not present in server capability
# try : as starttls, but does not fail is starttls not present in
# capability, and falls back to clear text connection if
# starttls not present. If STARTTLS is present in capability,
# and TLS negociation fails, connection fails.
# username : login name to use for connection
# password : password to use for connection
#
src:
type: imap
server: mail.mydomain
ssl_mode: direct
username: mylogin
password: mypassword
# port: 993
##
# destination account : defined same way as source, account, if is exactly the
# same account can be defined as src
#
# dst: src
dst:
type: imap
server: archive.server
ssl_mode: try
username: archivelogin
password: archivepassword
##
# General options for archiving
options:
# Top level folder for archives (all archives will go under this folder on dst
# server), default is INBOX
archive_folder: Archives
#
# time_folders: either yearly or monthly, if not defined archives will not
# have separated subfolders pear year or mont
time_folders: yearly
#
# In the archive, keep the original folder tree or not, (default yes)
keep_hierarchy : yes
#
# Do we archive unsubscribed folders
archive_unsubscribed : no
#
# Do we subscribe newly created folders in Archives ?
subscribe_new_folders: yes
##
# rules
#
# rules is a list of rules names with actions and paramaters attached to the
# name. A folder name matrches a rule name if the rule name is part of the
# hierarchy leading to the folder name, with '.' as a separator.
# eg with the following rules, folder lists.debian will have the first rule
# applied, folder lists.freebsd will have second rule applied.
# folder lists-temp will not match any rule and thus will have the default rule
# applied
# First matching rule is applied
#
# action can be keep, clean
# keep has no additional parameters, it means mails in folder matching the rule
# are not archived
# clean and archive have parameters :
# age : act on mails older than this number of days
# unread : if yes, act on unread emails (default no)
# marked : if yes, act on marked emails (default no)
#
# clean action means that the matching emails are deleted
#
# archive action means that the matching emails are moved to the dst account.
#
rules :
- lists.debian:
action: archive
age: 180
unread: yes
marked: yes
- lists:
action: keep
- spam:
action: clean
age: 14
unread: yes
marked: no
#
# rule to apply when no rule matches.
# default to a keep rule
default_rule:
action: archive
age: 90