3

I was trying to realized which configuration is telling where cur,tmp and new are created. Of course I've beein using virtual user and I receive and send mails into virtualuser/domain/user/Maildir/new and virtualuser/Maildir/cur (I think virtualuser/domain/user/Maildir/tmp is very temporarilly and never get and email) but when I create a new Mailbox using Postfixadmin it created like that

virtualuser/domain/user/tmp
virtualuser/domain/user/new
virtualuser/domain/user/cur

then I just need to move this tree folders inside

 virtualuser/domain/user/Maildir (this is how i would I would like to be created) so I would have:

 virtualuser/domain/user/Maildir/cur
 virtualuser/domain/user/Maildir/tmp
 virtualuser/domain/user/Maildir/new

So in which configuration file have this setting? Is Postfix, Dovecot or Postfixadmin?

In addition I have this conf:

# Postfix:
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
broken_sasl_auth_clients = yes
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
home_mailbox = Maildir/
html_directory = no
inet_interfaces = all
inet_protocols = all
local_recipient_maps = $virtual_mailbox_maps
local_transport = dovecot
mail_owner = postfix
mailbox_command = /usr/libexec/dovecot/dovecot-lda -f "$SENDER" -a "$RECIPIENT"
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
mynetworks_style = host
newaliases_path = /usr/bin/newaliases.postfix
queue_directory = /var/spool/postfix
relay_domains = $mydestination
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
smtpd_banner = $myhostname ESMTP
smtpd_delay_reject = yes
smtpd_helo_required = yes
smtpd_tls_auth_only = yes
smtpd_tls_loglevel = 1
smtpd_use_tls = yes
transport_maps = hash:/etc/postfix/transport
virtual_alias_maps = mysql:/etc/postfix/virtual_alias_maps.cf
virtual_mailbox_base = /home/virtualuser
virtual_mailbox_domains = mysql:/etc/postfix/virtual_mailbox_domains.cf
virtual_mailbox_limit = 512000000
virtual_mailbox_maps = mysql:/etc/postfix/virtual_mailbox_maps.cf
virtual_transport = virtual

 Dovecot:
 mail_home = 
 mail_location = maildir:~/Maildir

And /etc/postfix/virtual_mailbox_maps.cf has:

 ...
 table = mailbox
 select_field = maildir
 where_field = username 

and get from database a folder string like "virtualuser/domain/user"

  • Dunno... it depends on your configuration... Please post the output of postconf -n – masegaloeh Apr 7 '15 at 12:14
  • could you please read again, I think now is little bit clear. it create like virtualuser/domain/user/new and i would like to be like : virtualuser/domain/user/Maildir/new . Now I think , It whould be Postfixadmin configuration, am I wrong? – MikZuit Apr 7 '15 at 12:39
5

Taken from postfixadmin FAQ

1) Why isn't PostfixAdmin creating my mailbox?

PostfixAdmin is only a web interface for storing configuration settings. It does not (by default!) have the ability to create mail folders on disk. In a normal setup, sending the 'Welcome' email accomplishes this task - as Courier/Cyrus/etc do it (and have permission to do so)

So, we can conclude that postfix or dovecot who rule the location of your maildir...


Based from output of postconf -n above, apparently you use postfix virtual agent to perform incoming email delivery to Maildir. So we need to learn how virtual agent pick destination mailbox of incoming email. Taken from man 8 virtual

The mailbox location is controlled by the virtual_mailbox_base and virtual_mailbox_maps configuration parameters (see below). The virtual_mailbox_maps table is indexed by the recipient address as described under TABLE SEARCH ORDER below.

The mailbox pathname is constructed as follows:

    $virtual_mailbox_base/$virtual_mailbox_maps(recipient)

where recipient is the full recipient address.

So, in your case (/etc/postfix/virtual_mailbox_maps.cf), $virtual_mailbox_maps will selected with this query

SELECT maildir FROM mailbox WHERE username = $recipient;

Together with $virtual_mailbox_base, they construct the absolute path of mailbox.

Now, the question is where maildir field generated? Postfixadmin use 3 parameters to generated the maildir field,

  • $CONF['domain_path']
  • $CONF['domain_in_mailbox']
  • $CONF['maildir_name_hook']

You can search the explanation of those parameters in config.inc.php of postfixadmin.


So, if you need append /Maildir in virtual_mailbox_maps, then you can

  1. Alter select_field of /etc/postfix/virtual_mailbox_maps.cf.
  2. Write your maildir_name_hook function in postfixadmin.

If you plan to use option 1, you also needs to change the parameter of dovecot, especially in userdb parameter. Look for home field or mail_location field.

  • Weird , my virtual_mailbox_maps.cf look like this: table = mailbox select_field = maildir where_field = username and get from database a folder like "virtualuser/domain/user" because at some point something created like that in the db maildir field, and as far as I know should be the one who inserted in the table , say postfixadmin getting the parameters from postfix , I'm i right? but , you see my postfix configuration? everything look ok to me. Do I miss something? – MikZuit Apr 8 '15 at 15:08
  • I don't familiar with postfixadmin. Please edit the question and post the content of /etc/postfix/virtual_mailbox_maps.cf, config.inc.php from postfixadmin and version of postfixadmin – masegaloeh Apr 9 '15 at 1:38
  • @MikZuit, see updated answer – masegaloeh Apr 9 '15 at 13:45
  • You're right @masegaloeh , and you beat me for little hours I would resolve this for myself (think so) . Is postfixadmin with the $CONF['maildir_name_hook'] , you neew to create a function as config.inc.php to set the Maildir path as you want. Thanks dude – MikZuit Apr 9 '15 at 14:52
0

if you get from database a folder string like "virtualuser/domain/user" you should not have these 3 folders.

But if you get from database a folder string like "virtualuser/domain/user/" you should not have these 3 folders.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.