Re: [exim] Best approach for simple MySQL & 'Virtual' Domain…

Top Page

Reply to this message
Author: S2_u220@riotm.co.uk
Date:  
CC: exim-users
Subject: Re: [exim] Best approach for simple MySQL & 'Virtual' Domain/Users?
On Tue, 2012-04-10 at 09:55 +0100, Jeremy Harris wrote:
> On 10/04/2012 09:33, Ron White wrote:
> > For the life of me I can't remember how to set this up! I can't figure
> > which ROUTER to set up to do this.
>
> There's nothing special about particular routers. They do what you've
> configured them to, in the order they're run. So "which router"
> depends entirely on your specific configuration. You'd need to
> share it with us to get more specific help.
>
> > I have a feeling I'll need an ACL on that query
>
> Yes, _or_ carefully write the routers to validate the address and
> have your rcpt acl do a verify=recipient (which calls the routers
> in verify mode). Look around the documentation
> (http://exim.org/exim-html-current/doc/html/spec_html/index.html).
>
> > is there a
> > simple way of having the router jump to a transport if the query
> > matches, whilst expanding 'domain' and 'local_part' along the way?
>
> You could fill in "address_data". Or, as you have it:
> >
> > The transport, I guess, will be something like this:
> > local_mysql_delivery:
> >          driver  = appendfile
> >          directory = /var/mail/${domain}/${local_part}/

>
> ... just have the transport use the original. "jump to a transport"
> is merely specifying on the router which transport to use.
>
> -- 
> Cheers,
>      Jeremy

>
>

Thank you Jeremy,

I'll look around the ACL's for valid recipients.

Currently, I've got this pair work, but I will need to add further logic
to make sure I don't accept mail for domains/users not in the database.


begin routers
virtual_local:
        driver = redirect
        data = ${lookup mysql{SELECT mailbox FROM mailusers WHERE
domain='${quote_mysql:$domain}' AND username='${quote_mysql:
$local_part}' AND remote=0;}}
        file_transport = local_mysql_delivery



transports:
local_mysql_delivery:
        driver  = appendfile
        directory = /var/mail/${domain}/${local_part}/
        maildir_format


Thanks again