2014-10-09 17:04:12 +00:00
|
|
|
import textwrap
|
|
|
|
|
2014-08-22 15:31:44 +00:00
|
|
|
from django.conf import settings
|
2014-10-09 17:04:12 +00:00
|
|
|
from django.utils.translation import ugettext_lazy as _
|
2014-08-22 15:31:44 +00:00
|
|
|
|
|
|
|
|
2014-10-06 14:57:02 +00:00
|
|
|
MAILS_DOMAIN_MODEL = getattr(settings, 'MAILS_DOMAIN_MODEL', 'domains.Domain')
|
2014-08-22 15:31:44 +00:00
|
|
|
|
|
|
|
|
2014-10-06 14:57:02 +00:00
|
|
|
MAILS_HOME = getattr(settings, 'MAILS_HOME', '/home/%(name)s/')
|
2014-08-22 15:31:44 +00:00
|
|
|
|
2014-10-06 14:57:02 +00:00
|
|
|
|
|
|
|
MAILS_SIEVETEST_PATH = getattr(settings, 'MAILS_SIEVETEST_PATH', '/dev/shm')
|
|
|
|
|
|
|
|
|
|
|
|
MAILS_SIEVETEST_BIN_PATH = getattr(settings, 'MAILS_SIEVETEST_BIN_PATH',
|
2014-08-22 15:31:44 +00:00
|
|
|
'%(orchestra_root)s/bin/sieve-test')
|
|
|
|
|
|
|
|
|
2014-10-09 17:04:12 +00:00
|
|
|
MAILS_VIRTUAL_MAILBOX_MAPS_PATH = getattr(settings, 'MAILS_VIRTUAL_MAILBOX_MAPS_PATH',
|
|
|
|
'/etc/postfix/virtual_mailboxes')
|
|
|
|
|
2014-08-22 15:31:44 +00:00
|
|
|
|
2014-10-09 17:04:12 +00:00
|
|
|
MAILS_VIRTUAL_ALIAS_MAPS_PATH = getattr(settings, 'MAILS_VIRTUAL_ALIAS_MAPS_PATH',
|
|
|
|
'/etc/postfix/virtual_aliases')
|
2014-08-22 15:31:44 +00:00
|
|
|
|
|
|
|
|
2014-10-09 17:04:12 +00:00
|
|
|
MAILS_VIRTUAL_ALIAS_DOMAINS_PATH = getattr(settings, 'MAILS_VIRTUAL_ALIAS_DOMAINS_PATH',
|
|
|
|
'/etc/postfix/virtual_domains')
|
2014-08-22 15:31:44 +00:00
|
|
|
|
2014-10-06 14:57:02 +00:00
|
|
|
|
2014-10-09 17:04:12 +00:00
|
|
|
MAILS_VIRTUAL_MAILBOX_DEFAULT_DOMAIN = getattr(settings, 'MAILS_VIRTUAL_MAILBOX_DEFAULT_DOMAIN',
|
|
|
|
'orchestra.lan')
|
2014-10-06 14:57:02 +00:00
|
|
|
|
2014-10-09 17:04:12 +00:00
|
|
|
MAILS_PASSWD_PATH = getattr(settings, 'MAILS_PASSWD_PATH',
|
|
|
|
'/etc/dovecot/passwd')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MAILS_MAILBOX_FILTERINGS = getattr(settings, 'MAILS_MAILBOX_FILTERINGS', {
|
|
|
|
# value: (verbose_name, filter)
|
|
|
|
'DISABLE': (_("Disable"), ''),
|
|
|
|
'REJECT': (_("Reject spam"), textwrap.dedent("""
|
|
|
|
require ["fileinto","regex","envelope","vacation","reject","relational","comparator-i;ascii-numeric"];
|
|
|
|
if header :value "ge" :comparator "i;ascii-numeric" "X-Spam-Score" "5" {
|
|
|
|
discard;
|
|
|
|
stop;
|
|
|
|
}""")),
|
|
|
|
'REDIRECT': (_("Archive spam"), textwrap.dedent("""
|
|
|
|
require ["fileinto","regex","envelope","vacation","reject","relational","comparator-i;ascii-numeric"];
|
|
|
|
if header :value "ge" :comparator "i;ascii-numeric" "X-Spam-Score" "5" {
|
|
|
|
fileinto "Spam";
|
|
|
|
stop;
|
|
|
|
}""")),
|
|
|
|
'CUSTOM': (_("Custom filtering"), lambda mailbox: mailbox.custom_filtering),
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
MAILS_MAILBOX_DEFAULT_FILTERING = getattr(settings, 'MAILS_MAILBOX_DEFAULT_FILTERING', 'REDIRECT')
|