[Exim] Mysql and Cyrus integration

Startseite
Nachricht löschen
Nachricht beantworten
Autor: Sebastian Lemke
Datum:  
To: exim-users
Betreff: [Exim] Mysql and Cyrus integration
Hi @all,

>> Now I get an email 'unknown-user@???' and I would like to
>> forward this one to an real existing user at domain1.com - the same
>> thing for domain2.com. Therefore I don't want mails for unknown-users
>> get forwarded to one global account, but to one account per domain.
>
>Put this director before your systems_aliases director:
>
>virtual_domains:
> driver = aliasfile
> file = /usr/local/etc/exim/virtual
> include_domain
> search_type = lsearch*@
>
>Then in the file (/usr/local/etc/exim/virtual) you can have virtual

maps.
>
>user1@domain:    user1
>user2@domain:    user2
>*@domain1:    user1

>
>
>user1@domain2:    userX
>user2@domain2:    userY
>user3@domain2:    :blackhole:
>*@domain2:    userX


Now I have installed EXIM and it delivers the mail correctly into the
Cyrus Mailboxes - but I do not know, if the solution I choose the best
way to do it.

At first I have done the routing:

virtual_mysql:
    driver = redirect
    allow_fail
    allow_defer
    data = ${lookup mysql{ SELECT cyrmbox FROM emails \
        WHERE email='${local_part}@${domain}' }}
    file_transport = address_file
    pipe_transport = address_pipe
    reply_transport = address_reply


The result of the query is the mailbox-name of cyrus for this user.

Then I have done the following:

virtual_mysql_accept:
    driver = accept
    condition = ${lookup mysql{ SELECT cyrmbox FROM emails \
        WHERE cyrmbox='${local_part}' }}
    transport = local_delivery_cyrus


Is it the correct way to handle this ? First a "redirect" to the
cyrus-mailboxname then an accept if the mailbox exists ?

Between them I have this for handling unknown users:

# for handling 'unknown-user@???'
virtual_mysql2:
    driver = redirect
    allow_fail
    allow_defer
    data = ${lookup mysql{ SELECT cyrmbox FROM emails \
        WHERE email='*@${domain}' }}
    file_transport = address_file
    pipe_transport = address_pipe
    reply_transport = address_reply


In the Database is an entry with
*@testdomain.tld        my.user.box.name


It is not the way described above - is this correct ?

I believe I run into trouble, when the delivery fails; the address is
already re-written an so the bounced mail gets an incorrect sender (?).

Regards,
Sebastian