Charles Marcus a écrit : > Hello, > > Currently my virtual users are not organized by domain, and the > directory layout is: > > /var/virtual/mail/[EMAIL PROTECTED] > > with the following query to get the mailbox locations for virtual users: > > query = SELECT maildir FROM mailbox WHERE username='%s' > > I am planning on migrating everything to a new server and rearranging > things so that users are grouped by domain, ie: > > /var/virtual/mail/example.com/user1 > > I will have to add a new field to the Table that will contain the local > part of the users username (email address), and obviously I will need to > modify the above query to concatenate the two different fields, but I am > not well versed with SQL. >
assuming your table has a "user" and a "domain" table, query = select concat('/var/virtual/mail/', domain, '/', user) from yourtable where '%u' = user and '%d' = domain ... > Assuming the fieldnames are as specified ('domain' contains the domain > only, and 'local' contains the local part of the users email), my first > attempt will be: > > query = SELECT CONCAT(domain, '/', local) WHERE username='%s' > > Does this look even close? > > I know I'll have to mv the maildirs around, use a script. > and I will of course test > this once I get the new system up and ready, but I just want to check > myself... > > Thanks... >