dovecot pop3

Hello All

Been working at getting a mail server running using postfix dovecot sasl tsl and mysql as per here. Have solved most of the detailed configuration along the way by googling /var/log/maillog

The final hurdle is with dovecot pop3 and imap saying I have 0 messages - BUT mail is being delivered nicely to the virtual user directories in /usr/local/virtual

Anyone come across this behaviour of dovecot?

this is my dovecot -n output:
Code:
dovecot -n
# OS: FreeBSD 6.4-RELEASE-p1 i386  ufs
protocols: imap imaps pop3 pop3s
ssl_cert_file: /etc/ssl/dovecot/cert.pem
ssl_key_file: /etc/ssl/dovecot/key.pem
disable_plaintext_auth: no
login_dir: /var/run/dovecot/login
login_executable(default): /usr/local/libexec/dovecot/imap-login
login_executable(imap): /usr/local/libexec/dovecot/imap-login
login_executable(pop3): /usr/local/libexec/dovecot/pop3-login
login_greeting: Welcome to myhost - Dovecot ready.
first_valid_uid: 125
last_valid_uid: 125
first_valid_gid: 125
last_valid_gid: 125
mail_privileged_group: mail
mail_uid: 125
mail_gid: 125
mail_location: maildir:/usr/local/virtual/%d/%n
mail_executable(default): /usr/local/libexec/dovecot/imap
mail_executable(imap): /usr/local/libexec/dovecot/imap
mail_executable(pop3): /usr/local/libexec/dovecot/pop3
mail_plugins(default): quota imap_quota
mail_plugins(imap): quota imap_quota
mail_plugins(pop3): quota
mail_plugin_dir(default): /usr/local/lib/dovecot/imap
mail_plugin_dir(imap): /usr/local/lib/dovecot/imap
mail_plugin_dir(pop3): /usr/local/lib/dovecot/pop3
auth default:
  mechanisms: plain login
  passdb:
    driver: sql
    args: /usr/local/etc/dovecot-sql.conf
  socket:
    type: listen
    client:
      path: /var/spool/postfix/private/auth
      mode: 432
      user: postfix
      group: postfix
Any ideas?
Thanks
 
I managed to solve this - the Purplehat dovecot configuration page says you can configure the system to set up mailbox size quotas and if you aren't using them (i.e. not including the quotas section in the postfix main.cf described on the following page) you need to take out the code referencing quotas from the query in dovecot-sql.conf:
Code:
    user_query = SELECT maildir, 125 AS uid, 125 AS gid, CONCAT('maildir:storage=', FLOOR( quota / 1024 ) ) AS quota FROM mailbox WHERE username = '%u' AND active = '1'
So I'm trying:
Code:
    user_query = SELECT maildir, 125 AS uid, 125 AS gid, FROM mailbox WHERE username = '%u' AND active = '1'

Now the messages show with the pop3 list command. only trouble is even after adding
Code:
protocol pop3 {
pop3_client_workarounds = outlook-no-nuls oe-ns-eoh
pop3_uidl_format = %08Xv%08Xu
}
to dovecot.conf, in outlook the messages download completely blank - no subject no from line, only a few strange characters.

And so it goes on... thanks for listening
 
Change this:

Code:
mail_location: maildir:/usr/local/virtual/%d/%n

To this:

Code:
mail_location: maildir:/usr/local/virtual/domain.com/%n

Instead of using %d try and write the domain name. If it works I somewhat know what you're going through. I have the same issue. Exact same problem. I spent months on this. In total took me years to get to this point. If by putting your domain name directly in the datapath it proves that you're at the same stage as me.

What is happening is that postfix is correctly delivering your mail to the right folders and I bet you can send e-mails to users on the internet. You do physically see e-mails being stored on your server. Yet, thunderbird or any mail client will show you that you have no messages or mail.

What is happening is that the %d isn't grabbing your domain name and then displaying it in the mail location path. So, %d is receiving a blank. This is where I am at. I don't know exactly why this is happening but do know that the %d isn't grabbing the domain name; well it's grabbing nothing.

So, if what I said actually works then this is what is happening:

Code:
mail_location: maildir:/usr/local/virtual//%n

which should be like this:

Code:
mail_location: maildir:/usr/local/virtual//bob

I replaced %n with the username bob as an example but here would be any user that tries and logs into thunderbird or a mail_client. If you notice the %d isn't showing anything which means right now for some reason %d isn't grabbing the domain name and it's displaying nothing. This breaks the location path and this is why you can login to your account and no matter how many e-mails the user gets it will say that the user has no messages.

Yet, you may see that indeed the user gets the mail delivered to the right folder. It's because dovecot is using a broken mail_location path. I personally don't know what the solution is or what the main problem as to why %d isn't grabbing the domain name. I just figured it out without anyone's help on here.

Now, looking for someone that can point me to the right direction on how to fix this problem. I host multiple domains and need the mail to be in separate folders. So, I need to have the mail_location to be dynamic.
 
Ok, fixed the problem. If you're doing the same thing I am doing. Which is hosting multiple domain names on your mail server using mysql. What you need to do is store the full mail directory path in the mysql database. Then in dovecot config the mail_location, set it to /. What will happen is that the mysql database data will add onto the / path. Which would generate or give the right mail path for each different domain name and user. I got my mail server working 100% since 3 months ago.

Hope this helps anyone having the same issue I am having. Which was to get the mail_location go have the mail path generated on the fly from mysql. Before the problem was because of %d. If you have the user login with a username of like let's say bob it would tell dovecot that we don't have a domain just user. This would make %d to have nothing or a blank.

An easy way to test if this is your case is to turn on the debugging level on full and send yourself an e-mail and use Thunderbird or a mail-client to try and retrieve the mail. Then look into your mail.log file and see the error messages; you would see the mail path missing the domain name in the mail path.

This was my problem and issue. Which Thunderbird would show no new e-mails even though the mails were delivered successfully. Which was what my problem was.

Hope this helps anyone out there if they run into the same problem.
 
Back
Top