diff --git a/INSTALL b/INSTALL index 5afa15d1b..2f2dd95c3 100644 --- a/INSTALL +++ b/INSTALL @@ -332,7 +332,7 @@ For *MySQL* users, define the following map files on your server (it should work password = dbname = hosts = 127.0.0.1 - query = SELECT concat(t2.name, '/', t1.path) FROM admin_mailbox AS t1, admin_domain AS t2 WHERE t1.enabled=1 AND t1.domain_id=t2.id AND t1.address='%u' AND t2.enabled=1 AND t2.name='%d' + query = SELECT concat(t2.name, '/', t1.path, (SELECT value FROM lib_parameter WHERE name='admin.MAILDIR_ROOT', '/') FROM admin_mailbox AS t1, admin_domain AS t2 WHERE t1.enabled=1 AND t1.domain_id=t2.id AND t1.address='%u' AND t2.enabled=1 AND t2.name='%d' ``/etc/postfix/sql-aliases.cf``:: @@ -363,7 +363,6 @@ Then, use the following configuration in the */etc/postfix/main.cf* file # Stuff before mailbox_transport = virtual - home_mailbox = .maildir/ maildrop_destination_recipient_limit = 1 virtual_minimum_uid = virtual_gid_maps = static: @@ -429,6 +428,31 @@ to the ``virtual_alias_maps`` parameter like this:: Reload *postfix*. +.. _dovecot_lda: + +Optional: using Dovecot's LDA +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +If you are using *Dovecot* in your environnement, I recommend to use +its LDA. Doing so, you'll will be able to use extra functionalities +such as sieve filters and more. + +First, edit the */etc/postfix/main.cf* file and define (or modify if +they already exist) the following parameters:: + + virtual_transport = dovecot + dovecot_destination_recipient_limit = 1 + +If you have followed the :ref:`postfix-label` section to install your +environnement, you need to modify the SQL query corresponding to the +``virtual_mailbox_maps`` parameter. Edit the +*/etc/postfix/maps/sql-mailboxes.cf* and modify the ``query`` +parameter as follow:: + + query = SELECT concat(t2.name, '/', t1.path) FROM admin_mailbox AS t1, admin_domain AS t2 WHERE t1.enabled=1 AND t1.domain_id=t2.id AND t1.address='%u' AND t2.enabled=1 AND t2.name='%d' + +Restart *Postfix*. + .. _dovecot-label: Dovecot @@ -438,11 +462,14 @@ If you are using the *maildir* format to store mailboxes, add the following line into Dovecot's main config file (*/etc/dovecot/dovecot.conf*):: - mail_location = maildir:/%d/%n/.maildir + mail_location = maildir:/%h/.maildir + +The ``.maildir`` part is the previous example must match the value of +the ``MAILDIR_ROOT`` parameter. See :ref:`default-conf`. If you are using the mbox format, add the following:: - mail_location = mbox:/%d/%n/:INBOX=/%d/%n/Inbox + mail_location = mbox:/%h/:INBOX=/%h/Inbox To make the authentication work, edit *dovecot.conf* and add the following content inside:: @@ -562,6 +589,12 @@ modifications: Restart *Dovecot*. +.. note:: + + If you're using *Postfix* as MTA, you will have to use *Dovecot*'s + local delivery agent otherwise your emails won't get filtered. See + :ref:`dovecot_lda` to get information on how to activate this. + Migrating from other softwares ============================== diff --git a/admin/models.py b/admin/models.py index ad167ce14..60664174f 100644 --- a/admin/models.py +++ b/admin/models.py @@ -158,7 +158,7 @@ class Mailbox(DatesAware): if self.mbtype == "mbox": self.path = "%s/Inbox" % self.address else: - self.path = "%s/%s" % (self.address, self.mdirroot) + self.path = "%s/" % self.address if os.path.exists(abspath): return True if not exec_as_vuser("mkdir -p %s" % abspath): @@ -182,7 +182,7 @@ class Mailbox(DatesAware): code = exec_as_vuser("mv %s/%s %s/%s" \ % (path, self.address, path, newaddress)) if code: - self.path = "%s/%s/%s/" % (domain, newaddress, self.mdirroot) + self.path = "%s/" % newaddress return code def delete_dir(self):