This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
start:howto:dovecot_plus_database_quota [2013/06/10 09:55] aseques |
start:howto:dovecot_plus_database_quota [2013/06/21 07:36] (current) aseques removed the subdomain part since it didn't work and isn't of much interest |
||
---|---|---|---|
Line 5: | Line 5: | ||
==== Changes from standard mail setup in imscp ==== | ==== Changes from standard mail setup in imscp ==== | ||
- | * Alias and subdomains can be used as a full mail domains | + | * Alias can be used as a full mail domains |
* Global sieve filtering (already enabled by default but without config) | * Global sieve filtering (already enabled by default but without config) | ||
Line 39: | Line 39: | ||
More info about sieve syntax and usage: http://wiki.dovecot.org/LDA/Sieve | More info about sieve syntax and usage: http://wiki.dovecot.org/LDA/Sieve | ||
- | ===== Use domain alias/subdomain as a mail alias ===== | + | ===== Use domain alias as a mail alias ===== |
By doing a small change in postfix configuration, we can use the domain alias as a mail ailas. | By doing a small change in postfix configuration, we can use the domain alias as a mail ailas. | ||
Line 50: | Line 50: | ||
In the file main.cf (proposed changes are for the template), from: | In the file main.cf (proposed changes are for the template), from: | ||
virtual_mailbox_domains = hash:{MTA_VIRTUAL_DMN_HASH} | virtual_mailbox_domains = hash:{MTA_VIRTUAL_DMN_HASH} | ||
- | virtual_mailbox_maps = hash:{MTA_VIRTUAL_MAILBOX_HASH} | + | virtual_alias_maps = hash:{MTA_VIRTUAL_ALIAS_HASH} |
To: | To: | ||
Line 57: | Line 57: | ||
virtual_mailbox_domains = mysql:/etc/postfix/mysql_virtual_domains.cf | virtual_mailbox_domains = mysql:/etc/postfix/mysql_virtual_domains.cf | ||
| | ||
- | #virtual_mailbox_maps = hash:{MTA_VIRTUAL_MAILBOX_HASH} | + | #virtual_alias_maps = hash:{MTA_VIRTUAL_ALIAS_HASH} |
virtual_alias_maps = hash:{MTA_VIRTUAL_ALIAS_HASH}, mysql:/etc/postfix/mysql_virtual_forwards.cf | virtual_alias_maps = hash:{MTA_VIRTUAL_ALIAS_HASH}, mysql:/etc/postfix/mysql_virtual_forwards.cf | ||
Line 72: | Line 72: | ||
INNER JOIN domain ON domain_aliasses.domain_id=domain.domain_id | INNER JOIN domain ON domain_aliasses.domain_id=domain.domain_id | ||
WHERE domain.domain_status='ok' | WHERE domain.domain_status='ok' | ||
+ | AND domain_aliasses.alias_status='ok' | ||
AND domain.domain_mailacc_limit > '-1' | AND domain.domain_mailacc_limit > '-1' | ||
AND domain_aliasses.alias_name='%s') | AND domain_aliasses.alias_name='%s') | ||
Line 93: | Line 94: | ||
INNER JOIN domain_aliasses ON domain.domain_id = domain_aliasses.domain_id | INNER JOIN domain_aliasses ON domain.domain_id = domain_aliasses.domain_id | ||
WHERE domain_aliasses.alias_name = '%d' AND mail_users.mail_acc = '%u' | WHERE domain_aliasses.alias_name = '%d' AND mail_users.mail_acc = '%u' | ||
- | </code> | ||
- | |||
- | If you want the subdomains to be able to receive mail create this file: | ||
- | **/etc/dovecot/dovecot-sql-subdomain.conf** | ||
- | with the following content: | ||
- | |||
- | <code> | ||
- | driver = mysql | ||
- | connect = host=localhost dbname=imscp user=imscp_dovecot password=PASS_MAILRW | ||
- | user_query = SELECT CONCAT('/var/mail/virtual/', subdomain.subdomain_name, ".", domain.domain_name, '/',mail_acc) AS home, '1001' AS uid, '8' AS gid FROM (mail_users INNER JOIN subdomain ON mail_users.sub_id = subdomain.subdomain_id) INNER JOIN domain ON mail_users.domain_id = domain.domain_id WHERE mail_acc='%n' and concat(subdomain.subdomain_name,".",domain.domain_name)='%d'; | ||
</code> | </code> | ||
Line 124: | Line 115: | ||
} | } | ||
- | ===== Frequent issues ===== | + | ===== Deprecated documentation (pending to be purged) ===== |
+ | |||
+ | **NOTE:** In the SQL query for user_query there are uids and gids 'hardcoded'. The uid must be the uid of your vmail user and gid the gid of the mail group. Maybe you have to change the defaults (1001/8)) | ||
==== Adapt postfix master.cf ==== | ==== Adapt postfix master.cf ==== | ||
Line 145: | Line 139: | ||
flags=DROhu user=vmail:mail argv=/usr/libexec/dovecot/deliver -f ${sender} -d ${recipient} | flags=DROhu user=vmail:mail argv=/usr/libexec/dovecot/deliver -f ${sender} -d ${recipient} | ||
- | ===== Older documentation (pending to be purged) ===== | ||
- | |||
- | **NOTE:** In the SQL query for user_query there are uids and gids 'hardcoded'. The uid must be the uid of your vmail user and gid the gid of the mail group. Maybe you have to change the defaults (1001/8)) |