Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

i have been spending countless hours on this and now i figured id come to the 'internet' for help.

I have installed a new install of postfix + dovecot + mysql.

Right now, i am able to receive email from my one mapped account 'sean@domain.com' but for some reason all messages get inserted into /var/mail/sean

the expected location is: /var/vmail/domain.com/sean

ill list the key pieces of code ive used to get this working.

postfix master.cf

dovecot   unix  -       n       n       -       -       pipe
flags=DRhu user=vmail:mail argv=/usr/lib/dovecot/deliver -d ${recipient}

postfix main.cf

virtual_transport = dovecot
dovecot_destination_recipient_limit = 1

Dovecot 10-mail.conf

mail_location = maildir:/var/vmail/%d/%n
mail_uid = vmail
mail_gid = mail
first_valid_uid = 150
last_valid_uid = 150

Dovecot 10-auth.conf

disable_plaintext_auth = yes
!include auth-sql.conf.ext

Dovecot auth-sql.conf.ext

passdb {
driver = sql
args = /etc/dovecot/dovecot-sql.conf.ext
}
userdb {
driver = sql
args = /etc/dovecot/dovecot-sql.conf.ext
}

Dovecot dovecot-sql.conf.ext

driver = mysql
connect = host=localhost dbname=mail user=mail password=P@ssw0rd
default_pass_scheme = MD5-CRYPT

password_query = \
SELECT username as user, password, '/var/vmail/%d/%n' as userdb_home, \
'maildir:/var/vmail/%d/%n' as userdb_mail, 150 as userdb_uid, 8 as userdb_gid \
FROM mailbox WHERE username = '%u' AND active = '1'

user_query = \
SELECT '/var/vmail/%d/%n' as home, 'maildir:/var/vmail/%d/%n' as mail, \
150 AS uid, 8 AS gid, concat('dirsize:storage=', quota) AS quota \
FROM mailbox WHERE username = '%u' AND active = '1'

And that pretty much does it for the config part of what i'm trying to do.

Any ideas of what i'm doing wrong? { I should be bald by this time tomorrow :) }

share|improve this question

3 Answers 3

I guess you are confusing two categories of users. There are the SystemUsers and the VirtualUSers.

If you try to use a systemuser just need to add this line:

mailbox_command = /usr/local/libexec/dovecot/deliver
#  or
mailbox_command = /usr/libexec/dovecot/deliver
#  or
mailbox_command = /usr/lib/dovecot/deliver
#  or wherever it was installed in your system.

If you are trying to use a virtualusers, you have to configure them on postfix also.

Something like this: obs: I will try to use your mysql confs, but not ure if i will get it right.

/etc/postfix/virtual-address-mysql.cf

Content:

user=mail
password=P@ssw0rd
dbname=mail
hosts=localhost
query=select username as address from mailbox where active = '1' and username = '%s';

Look, i might be missing something about your query.

Now postfix is able to know your virtualuser

Need to map it now.

proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_mailbox_maps $virtual_mailbox_domains
virtual_mailbox_maps =  proxy:mysql:/etc/postfix/virtual-address-mysql.cf

I would go to virtual users, better to manage a db than system users.

You can do also virtual domains and virtual alias

Same logic and the conf is like this:

virtual_mailbox_domains = proxy:mysql:/etc/postfix/vdomains.cf
virtual_alias_maps = proxy:mysql:/etc/postfix/virtual-alias.cf

I guess that its. If need more help i guess you can find in

Dovecot Wiki

share|improve this answer

had the same problem. after a week of nights, found that you may need to create the folder INBOX under /home/username/mail/.imap/INBOX.

That did the trick for me.

System is roundcube / dovecot / postfix / mysql /centos 6.4 Hope I can spare some ones sanity!!

Paul.

share|improve this answer

The problem in your "virtual_mailbox_map.cnf" file (may have different name) it should be something like this

hosts = 127.0.0.1
user = postfix
password = password
dbname = postfix
query = SELECT CONCAT(domain, '/', maildir) FROM mailbox WHERE username='%s' AND active = 1

The fix in a query because in all manuals that I saw they use something like this

query = SELECT maildir FROM mailbox WHERE username='%s' AND active = 1
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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