logo       

Feature Request (Source included): MySQL result inside of maildroprc: msg#00032

mail.maildrop

Subject: Feature Request (Source included): MySQL result inside of maildroprc

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,

Serge Stepanov
Enterprise Architect & CTO
VisualCafe Studios




-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise