Re: [exim] pgsql lookup

Top Page
Delete this message
Reply to this message
Author: Michael Dominok
Date:  
To: exim-users
Subject: Re: [exim] pgsql lookup
Hi,

On Wed, 2004-11-17 at 18:40, Johannes Berg wrote:
> You'll need to write a router for that which checks the database, and
> then calls a transport, for example the maildir transport (you may need
> a modified maildir transport because the directory= may need to be
> different).
>
> I think. I'm not really sure on this, maybe you can google for something
> like "pgsql exim router".


I'm using this router to accept User listed in an
OpenGroupware.org-(Postgres-)Database.

ogo_user_by_email:
    debug_print = "R: ogo_user_by_email for $local_part@$domain"
    driver = accept
    condition = ${lookup pgsql{SELECT COUNT (*) FROM company_value cv,
person p \
                WHERE (cv.db_status = p.db_status) AND (cv.db_status !=
'archived')     \
                AND (cv.attribute = 'email1') AND
(LOWER(cv.value_string) = LOWER('$local_part@$domain'))    \
                AND (cv.company_id = p.company_id) AND (p.is_account =
1) }}
    transport = ogo_maildir_by_email



I guess you can drop the OGo-specific Stuff but be aware that SQL is
Case-Sensitive and SMTP is not. Hence the "LOWER".

To automacally create Maildirs insert

maildir_format = true
create_directory = true

into your Transport.

HTH

Michael

-- 
Michael Dominok        Tel.: +49 231 61048 - 42
natural computing GmbH    Fax.: +49 231 61048 - 40
Martener Strasse 535     Mail: michael.dominok@???
44379 Dortmund         http://www.natural-computing.de/