9 messages in net.sourceforge.lists.courier-maildropRe: [maildropl] converting from maild...
FromSent OnAttachments
HeikoAug 19, 2008 12:03 am 
HeikoAug 19, 2008 12:09 am 
Sam VarshavchikAug 19, 2008 4:02 am 
HeikoAug 19, 2008 4:18 am 
HeikoAug 19, 2008 4:54 am 
Sam VarshavchikAug 19, 2008 3:25 pm 
Sam VarshavchikAug 19, 2008 3:26 pm 
HeikoAug 20, 2008 12:53 am 
Sam VarshavchikAug 20, 2008 4:09 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: [maildropl] converting from maildroprc quota to mysql quotaActions...
From:Heiko (rupe@gmail.com)
Date:Aug 20, 2008 12:53:37 am
List:net.sourceforge.lists.courier-maildrop

On Wed, Aug 20, 2008 at 12:26 AM, Sam Varshavchik <mrs@courier-mta.com> wrote:

Heiko writes:

On Tue, Aug 19, 2008 at 1:19 PM, Heiko <rupe@gmail.com> wrote:

On Tue, Aug 19, 2008 at 1:03 PM, Sam Varshavchik <mrs@courier-mta.com> wrote:

Heiko writes:

Hello, i have a 2 machine courier cluster which served only one domain in the past, but now we have a second domain, up to now we used quota for the maildir that was definded in the /etc/maildroprc ( `echo 52428800S >> $VHOME/$USERDOMAIN/$ACCOUNT/maildirsize`). now we would like to set the quota inside the DB, which is already used for postfix/courier authentification, and there is also already a quota field:

+-------------------------+----------------------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra |

+-------------------------+----------------------------------+------+-----+---------+-------+ | email | varchar(255) | NO | PRI | NULL | | | domain | varchar(255) | NO | MUL | NULL | | | firstname | varchar(50) | YES | | NULL | | | fullname | varchar(100) | YES | | NULL | | | mailboxtype | enum('person','group','service') | NO | | NULL | | | password_encrypt | char(13) | NO | | NULL | | | password_sha1 | char(40) | NO | | NULL | | | quota_byte | int(10) unsigned | NO | | NULL | | | use_imap | enum('true','false') | NO | | true | | | use_directsmtp | enum('true','false') | NO | | true | | | mailhost | varchar(100) | NO | MUL | NULL | | | lastchanged_timestamp | timestamp | YES | | NULL | | | deleterequest_timestamp | timestamp | YES | | NULL | |

what is the easiest way to use this quota field instead of the maildroprc?

You'll have to configure courier-authlib to use a custom query. maildrop expects the quota field to be the same as it would appear in maildirsize, such as "52428800S", however you have defined your quota field to be an int. Therefore, you will need to set up a custom query that retrieves this field and appends an "S" to it. See the comments in authmysqlrc for more information.

Hello Sam,

so I have to customize the query in /etc/postfix/mysql-virtual_mailbox_limit_maps.cf or somewhere inside the courier or maildrop configs? Looks like this was wrong all the time, that why it didnt work in the first time :(. my authmysqlrc looks like this:

MYSQL_SERVER 192.2.2.101 MYSQL_USERNAME postfix MYSQL_PASSWORD mail MYSQL_PORT 0 MYSQL_DATABASE mail MYSQL_USER_TABLE users MYSQL_CRYPT_PWFIELD password_encrypt #MYSQL_CLEAR_PWFIELD password MYSQL_UID_FIELD 5000 MYSQL_GID_FIELD 5000 MYSQL_LOGIN_FIELD email MYSQL_HOME_FIELD "/home/vmail" MYSQL_MAILDIR_FIELD

CONCAT(SUBSTRING_INDEX(email,'@',-1),'/',SUBSTRING_INDEX(email,'@',1),'/') #MYSQL_MAILDIR_FIELD maildir # CONCAT(SUBSTRING_INDEX(email,'@',-1),'/',SUBSTRING_INDEX(email,'@',1),'/') #MYSQL_NAME_FIELD MYSQL_QUOTA_FIELD quota_byte MYSQL_AUXOPTIONS_FIELD CONCAT("mailhost=",mailhost)

ok, I now have it working, changing the value in the DB adn sending a new mail, results changed quota/rejection of mail of overquota. One thing i dont like is the message that the sender gets, looks to complicated for average users:

Aug 19 11:48:17 backend-B1 postfix/pipe[6403]: A4997D70163: to=<alb@bla.com>, relay=maildrop, delay=0.16, delays=0.06/0.01/0/0.09, dsn=5.7.0, status=bounced (permission denied. Command output: maildirmake: /home/vmail//bla.com/albert: File exists maildirmake: /home/vmail//bla.com/albert/.Sent: File exists maildirmake: /home/vmail//bla.com/albert/.Trash: File exists maildrop: maildir over quota. )

thank you so far for your help

You have a broken mail delivery or a filtering script. These messages are generated by invoking maildirmake either in your delivery script or maildroprc, when these folders already exist. Fix your script.

Hello, i changed some things and now the line looks like this:

#< #5.7.0 x-unix; maildrop: authlib: groupid=5000> #SMTP#

Cant I create a custom message when the quota is full in maildrop?

I attached my maildroprc, maybe someone of you has a idea how to solve this:

SHELL=/bin/bash # Ruta al /home/vmail/domains VHOME="/home/vmail/" # This extracts the username part from username at domain.tld ACCOUNT=`echo "$LOGNAME" | cut -d@ -f1` # This extracts the domain name from username at domain.tld USERDOMAIN=`echo "$LOGNAME" | cut -d@ -f2` # Path to the file where we will log the account creation. VMAIL_LOGFILE="/home/vmail/maildrop-maildirmake.log" # Path to maildirmake MAILDIRMAKE=/usr/bin/maildirmake #ISDIR=0 # Let's check if /home/vmail/domain.tld/username exists

`test -d "$VHOME/$USERDOMAIN/$ACCOUNT"` if( $RETURNCODE == 1) { MESSAGE_DATE = `date` # Log the creation date of this account in maildrop-maildirmake.log `echo CREATION DATE: "$MESSAGE_DATE" >> $VMAIL_LOGFILE` # Log the full path of the mailbox directory in maildrop-maildirmake.log `echo EMAIL DIRECTORY: "$VHOME/$USERDOMAIN/$ACCOUNT" >> $VMAIL_LOGFILE` # Log the username at domain.tld in maildrop-maildirmake.log `echo USER EMAIL LOGIN: "$LOGNAME" >> $VMAIL_LOGFILE` # Append a blanck line to maildrop-maildirmake.log `echo " " >> $VMAIL_LOGFILE`

# Now check if the domain directory /home/vmail/dominio.tld exists. `test -d "$VHOME/$USERDOMAIN"` if( $RETURNCODE == 1 ) { # Log the domain directory to maildrop-maildirmake.log `echo CREATING DIRECTORY: "$VHOME/$USERDOMAIN" >> $VMAIL_LOGFILE` # This creates the domain directory under /home/vmail/domains/ `mkdir -p "$VHOME/$USERDOMAIN"` # Append a blanck line to maildrop-maildirmake.log `echo " " >> $VMAIL_LOGFILE` } # Create the mailbox directory for the new account, this will be: # /home/vmail/domains/domain.tld/username/ `$MAILDIRMAKE "$VHOME/$USERDOMAIN/$ACCOUNT"` # Lets create the Sent directory for IMAP users `$MAILDIRMAKE -f Sent "$VHOME/$USERDOMAIN/$ACCOUNT"` # Suscribe the new Sent directory to the suscribed folders, only for courier-imap users. `echo INBOX.Sent >> $VHOME/$USERDOMAIN/$ACCOUNT/courierimapsubscribed` # Lets create the Thrash directory for IMAP users `$MAILDIRMAKE -f Trash "$VHOME/$USERDOMAIN/$ACCOUNT"` # Suscribe the new Trash directory to the suscribed folders, only for courier-imap users. `echo INBOX.Trash >> $VHOME/$USERDOMAIN/$ACCOUNT/courierimapsubscribed` # Create the curierimapuiddb directory under the user maildir `touch $VHOME/$USERDOMAIN/$ACCOUNT/courierimapuiddb` # Create the courierimapkeywords file under the user maildir `mkdir -p "$VHOME/$USERDOMAIN/$ACCOUNT/courierimapkeywords"` ##### # Create maildirsize quota file # `maildirmake -q 52428800S $VHOME/$USERDOMAIN/$ACCOUNT`

}

# GLOBAL VARIABLES # HOME=/home/vmail/dominios # LOGNAME=username at dominio.tld # DEFAULT=dominio.tld/username/

# Log everything to this file logfile "/home/vmail/maildrop.log"

# LOG BEGING OF FILTERING log "==== BEGIN maildrop processing for $LOGNAME ==="

exception { log "Including $HOME/$DEFAULT.mailfilter" include "$HOME/$DEFAULT.mailfilter" }

## # move spam to spamfolder ## SPAMFLD=$DEFAULT/.Junk/ SUBSCRIPT=$DEFAULT/courierimapsubscribed

# test idf Junk folder exists, if notr create one # autosubscribe to the Junk folder `test -d "$SPAMFLD"` if( $RETURNCODE == 1 ) { `maildirmake "$SPAMFLD"` `echo INBOX.Junk >> $SUBSCRIPT` }

## verschiebe die mail in den Junk Ordner, wenn Spam if (/^X-Spam-Status: Yes,/) { exception { to $SPAMFLD } }

greetings