Lähettäjä: Steve Thomas Päiväys: Vastaanottaja: Matt Kopio: exim-users Aihe: Re: [Exim] Virtual domains & users with mysql.
On Sat, Oct 04, 2003 at 12:32:31AM +0100, Matt is rumored to have said: >
> Does anyone have a smaple config for exim 4.xx which will read users and domains from mysql and store mail in /var/spool/$domain/$user
>
> been trying to do this for months with no luck
>
> would prefer mysql although flat files wouldn't bother me.
I'm no exim guru, but this is from my config, which seems to work well. I wrote some quick and dirty perl scripts to manage the users. Most of this is from a HowTo I found on the web, but can't seem to find now. Be sure to edit the details as needed... Hopefully this will help you out in getting it running.
In the main part of your config file, put:
hide mysql_servers = localhost/dbname/dbuser/dbpassword
domainlist local_domains = @ : mysql;SELECT userid FROM domains WHERE userid='$domain';
My router for virtual users is as follows:
# mysql users
virtual_users:
driver = redirect
allow_fail
allow_defer
data = ${lookup mysql{select maildir from users where id='$local_part@$domain'}{$value}fail}
directory_transport = virtual_delivery
Here's the virtual_delivery transport:
virtual_delivery:
driver = appendfile
maildir_format
delivery_date_add
envelope_to_add
return_path_add
group = mail
user = mail
mode = 0660
The structure I'm using for the mysql db is as follows: