diff --git a/README.md b/README.md index 85d2ae3..e36483d 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,11 @@ -# mail_archive +# Email archive script # -Script to archive emails from one imap account to another. -Intended to be able to add other backends \ No newline at end of file + +## Goal ## + +The goal is to provide a script able to connect to a `source` email, account, retrieve all old +email (definition of old coming from configuration and either move it to an archive folder on +another account or delete it. + +First version will only know of an imap email backend, but architecture should allow to add +other email backends (eg. EWS or a local Maildir) diff --git a/template_conf.yml b/template_conf.yml new file mode 100644 index 0000000..f05e0c1 --- /dev/null +++ b/template_conf.yml @@ -0,0 +1,108 @@ +## +# 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 + + +