2 messages in net.sourceforge.lists.courier-maildrop[maildropl] Feature Request (Source i...
FromSent OnAttachments
Serge StepanovJan 19, 2004 2:09 pm 
Devin RubiaJan 20, 2004 7:51 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:[maildropl] Feature Request (Source included): MySQL result inside of maildroprcActions...
From:Serge Stepanov (ser@gfxcafe.com)
Date:Jan 19, 2004 2:09:41 pm
List:net.sourceforge.lists.courier-maildrop

Good day fellow maildrop users!

I was coming up at the final stop on my path to a perfect installation of Postfix + Courier + SASL + MySQL + SpamAssassin w/ Maildrop and realized that the way to setup maildrop described in major HOWTOs was not the most optimal solution.

What I wanted to do is this: Retrieve homedir and maildir information from a MySQL table based on the email address and deliver to the user's mailbox (/home/vmail/domain.tld/user/Maildir/) all through one file, /etc/maildroprc. The only thing preventing me from doing this was that I had no way to (or at least wasn't aware of any way) to access the variables returned from the MySQL query in my maildroprc file.

After digging through the source code, I come up with the following solution (this applies to maildrop 1.6.3, but should work in older versions as well):

Go into: <courier-maildrop-source>/maildrop

Open maildrop.h, go to line 42, it will be the line that declares the init_quota variable. Add the following right under it:

Buffer init_maildir; // Initial MAILDIR

Open main.C, go to line 252 and add the following:

name="MAILDIR"; SetVar(name, maildrop.init_maildir);

Go to line 357 and add the following:

maildrop->init_maildir=mrec->maildir;

Re-run "make" and it should compile without a hitch. I ask that this feature be added in the next release of maildrop as it will probably benefit other users as well.

For those wondering, here is how it comes together in my maildroprc file:

-------------------------------------------------------------------------

if ( $SIZE < 26144 ) { exception { xfilter "/usr/bin/spamassassin -t" } }

if (/^X-Spam-Flag: *YES/) { exception { to "$HOME/$MAILDIR/.Spam/" } } else { exception { to "$HOME/$MAILDIR" } }

Best regards,