User Tools

Site Tools


start:howto:dovecot_plus_database_quota

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
start:howto:dovecot_plus_database_quota [2012/01/09 15:13]
aseques [Older documentation (pending to be purged)]
start:howto:dovecot_plus_database_quota [2012/01/10 08:38]
aseques
Line 1: Line 1:
 **__ALERT: This document is currently being rewritten, only experienced people should use this__** **__ALERT: This document is currently being rewritten, only experienced people should use this__**
  
-====== Dovecot modifications from default imscp install ​======+===== Dovecot modifications from default imscp install =====
 This is an improved version from the original article in ispcp (http://​isp-control.net/​documentation/​howto:​mail:​replace_courier_with_dovecot) This is an improved version from the original article in ispcp (http://​isp-control.net/​documentation/​howto:​mail:​replace_courier_with_dovecot)
 All the parts related to the default install where removed since imscp already takes care of that, and it's focused to add the functionality that is available only on dovecot (instead of courier). All the parts related to the default install where removed since imscp already takes care of that, and it's focused to add the functionality that is available only on dovecot (instead of courier).
 +The required dovecot version is now 1.2 (squeeze'​s default)
  
 ===== Changes from standard dovecot in imscp ===== ===== Changes from standard dovecot in imscp =====
-  * Quotas are stored on database so they can be shown from the control panel +  * Alias and subdomains ​can be used as a full mail domains 
-  * Required dovecot version is now 1.2 (squeeze'​s default) +  * Warning users that are overquota
-  * Filtering is enabled by default (to archive spam)+
  
 ===== Reasons to use dovecot ===== ===== Reasons to use dovecot =====
Line 34: Line 34:
 ==== Sieve filtering ==== ==== Sieve filtering ====
  
-Create ​the sieve script ​to redirect spam to junk folder +There is the global ​script ​located in /​etc/​dovecot/​sieve/​dovecot.sieve,​ it can be edited to suit your needs with more functionality. 
-**/​etc/​dovecot/​sieve/​dovecot.sieve**  +In the default install it moves all the mails tagged as spam to the Junk folder ​of the mail user
-If you have a spam filter such as amavis, it will add the header "​X-Spam-Flag = yes", with this little sieve script all this mail will go to Junk folder (can be seen both in webmail or any IMAP client)It's really usefull because ​all the users can check their own spam without ​the need of the server admin+More info about sieve syntax and usage: http://wiki.dovecot.org/LDA/Sieve
- +
-  mkdir /​etc/​dovecot/​sieve +
-  chown -R vmail:mail /etc/dovecot/​sieve/​ +
-  touch /​etc/​dovecot/​sieve/​dovecot.sieve +
- +
-  require "​fileinto";​ +
-    if exists "​X-Spam-Flag"​ { +
-            if header :contains "​X-Spam-Flag"​ "​NO"​ { +
-            } else { +
-            fileinto "​INBOX.Junk";​ +
-            stop; +
-            } +
-    } +
- +
- +
-Set correct permissions for dovecot.conf (the deliver command will access this file too) +
- +
-  chmod 0644 /etc/dovecot/​dovecot.conf+
  
 ==== Use domain alias as mail alias too ==== ==== Use domain alias as mail alias too ====
  
-Making ​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. 
-Being example2.com an alias of example1.com,​ whenever ​create a mailbox in example1.com the same mailbox in example2.com becomes a redirection. +Being example2.com an alias of example1.com,​ whenever ​we create a mailbox in example1.com the same mailbox in example2.com becomes a redirection. 
-So creating [email protected] will also receive the mail from [email protected] automatically.+So creating [email protected] will also receive the mail from [email protected] automatically. That can be used when a customer don't want the hassle of managing two mail domain (and having to set manually every mail address two times).
  
 /​etc/​postfix/​mysql_virtual_domains.cf /​etc/​postfix/​mysql_virtual_domains.cf
 <​code>​ <​code>​
-user = ispcp_dovecot +user = DATABASE_USER 
-password = PASS_MAILRW+password = DATABASE_PASSWORD
 hosts = 127.0.0.1 hosts = 127.0.0.1
-dbname = ispcp+dbname = DATABASE_NAME
 query = (SELECT domain_name FROM domain_aliasses query = (SELECT domain_name FROM domain_aliasses
                 INNER JOIN domain ​ ON domain_aliasses.domain_id=domain.domain_id ​                 INNER JOIN domain ​ ON domain_aliasses.domain_id=domain.domain_id ​
Line 83: Line 65:
 /​etc/​postfix/​mysql_virtual_forwards.cf /​etc/​postfix/​mysql_virtual_forwards.cf
 <​code>​ <​code>​
-user = ispcp_dovecot +user = DATABASE_USER 
-password = PASS_MAILRW+password = DATABASE_PASSWORD
 hosts = 127.0.0.1 hosts = 127.0.0.1
-dbname = ispcp+dbname = DATABASE_NAME
 query = query =
         SELECT DISTINCT CONCAT(CONCAT(mail_users.mail_acc,​ "​@"​),​ domain.domain_name) from mail_users         SELECT DISTINCT CONCAT(CONCAT(mail_users.mail_acc,​ "​@"​),​ domain.domain_name) from mail_users
Line 104: Line 86:
 If the user's quota reaches the limit the external script dovecot-quota-warning.sh is run. If you define quota warnings make sure that you start with the highest limit because Dovecot only runs the command for the first limit that is exceeded. If the user's quota reaches the limit the external script dovecot-quota-warning.sh is run. If you define quota warnings make sure that you start with the highest limit because Dovecot only runs the command for the first limit that is exceeded.
  
-Create ​**/​usr/​local/​bin/​dovecot-quota-warning.sh**+create ​**/​usr/​local/​bin/​dovecot-quota-warning.sh** 
 +Give appropiate permissions to the file 
 +  chmod 755 /​usr/​local/​bin/​dovecot-quota-warning.sh
 <​code>​ <​code>​
 #!/bin/sh #!/bin/sh
/var/www/virtual/i-mscp.net/wiki/htdocs/data/pages/start/howto/dovecot_plus_database_quota.txt · Last modified: 2013/06/21 07:36 by aseques