diff --git a/INSTALL b/INSTALL index d50845c98..689c3e9a4 100644 --- a/INSTALL +++ b/INSTALL @@ -246,7 +246,7 @@ First, define the following map files on your server (it should work with password = dbname = hosts = 127.0.0.1 - query = SELECT concat(t2.address, '@', t3.name) FROM admin_domainaliases AS t1, admin_mailbox AS t2, admin_domain AS t3 WHERE t1.target_id=t2.domain_id AND t2.domain_id=t3.id AND t2.enabled=1 AND t1.name='%d' AND t2.address='%u' + query = SELECT concat(t3.name, '/', t2.path) FROM admin_domainalias AS t1, admin_mailbox AS t2, admin_domain AS t3 WHERE t1.target_id=t2.domain_id AND t2.domain_id=t3.id AND t1.name='%d' AND t2.address='%u' Then, use the following configuration in the */etc/postfix/main.cf* file (this is just one possible configuration):: @@ -264,8 +264,8 @@ Then, use the following configuration in the */etc/postfix/main.cf* file virtual_mailbox_domains = mysql:/etc/postfix/sql-domains.cf virtual_alias_domains = mysql:/etc/postfix/sql-domain-aliases.cf virtual_mailbox_maps = mysql:/etc/postfix/sql-mailboxes.cf - mysql:/etc/postfix/sql-domain-aliases-mailboxes.cf - virtual_alias_maps = mysql:/etc/postfix/sql-aliases.cf + virtual_alias_maps = mysql:/etc/postfix/sql-aliases.cf, + mysql:/etc/postfix/sql-domain-aliases-mailboxes.cf # Stuff after NB: Modoboa supports both maildir and mbox formats. You can specify diff --git a/admin/models.py b/admin/models.py index c9d869223..c50300095 100644 --- a/admin/models.py +++ b/admin/models.py @@ -103,6 +103,8 @@ class Mailbox(models.Model): super(Mailbox, self).__init__(*args, **kwargs) self.mbtype = parameters.get_admin("MAILBOX_TYPE") self.mdirroot = parameters.get_admin("MAILDIR_ROOT") + if not self.mdirroot.endswith('/'): + self.mdirroot += '/' def __str__(self): return self.__full_address() @@ -116,9 +118,9 @@ class Mailbox(models.Model): relpath = "%s/%s" % (self.domain.name, self.address) abspath = os.path.join(parameters.get_admin("STORAGE_PATH"), relpath) if self.mbtype == "mbox": - self.path = "%s/Inbox" % relpath + self.path = "%s/Inbox" % self.address else: - self.path = "%s/%s" % (relpath, self.mdirroot) + self.path = "%s/%s" % (self.address, self.mdirroot) if os.path.exists(abspath): return True if not exec_as_vuser("mkdir -p %s" % abspath):