I just developed this for a guy who had only one email address for his
domain. Instead of having several email addresses what I did was if he
created an IMAP folder then the email address folder@??? would go
directly into that folder.
This isn't going to just work for everyone. You would have to recode it
for your server. Here's my code. I'm using symlinks so I used the link
"default" to go to the user who gets the mail into the folders.
Router:
virtual_localuser_default_foldermode:
driver = accept
require_files = /vhome/$domain/home/default/$local_part
retry_use_local_part
transport = virtual_localuser_default_foldermode
user = root
Transport.
virtual_localuser_default_foldermode:
driver = appendfile
allow_symlink
create_directory
delivery_date_add
directory_mode = 600
envelope_to_add
file = /vhome/$domain/home/default/$local_part
group = mail
mode = 600
return_path_add
user = ${extract{2} {:} {${lookup {default} lsearch
{/etc/vmail/passwd.$domain} {$value}}}}