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 setup dovecot and postfix on my server. I am able to send emails though SMTP to my GMail account and authenticate Thunderbird to my server via IMAP. However, when I send an email from my GMail account to the address from my server (admin@foobar.com), the email gets rejected and I am told the user was not found in the local recipents table.

I suspect that Postfix somehow fails to work with my dovecot userdb file.

Here is my postfix' main.cf:

# Debian specific:  Specifying a file name will cause the first
# line of that file to be used as the name.  The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname

smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no

# appending .domain is the MUA's job.
append_dot_mydomain = no

# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h

readme_directory = no

# TLS parameters
smtpd_tls_cert_file = /etc/dovecot/dovecot.pem
smtpd_tls_key_file = /etc/dovecot/private/dovecot.pem
smtpd_use_tls = yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.

smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = foobar.com
mydomain = foobar.com
mydestination = foobar.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = foobar.com, localhost.lan, localhost
relayhost =
mynetworks = [::ffff:]/104 [::1]/128
mailbox_command = /usr/lib/dovecot/deliver -c /etc/dovecot/dovecot.conf -m "${EXTENSION}"
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
home_mailbox = Maildir/
smtpd_sasl_auth_enable = yes
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/dovecot-auth
smtpd_sasl_authenticated_header = yes
smtpd_sasl_security_options = noanonymous
smtpd_sasl_local_domain = $myhostname
broken_sasl_auth_clients = yes
smtpd_recipient_restrictions = reject_unknown_sender_domain, reject_unknown_recipient_domain, reject_unauth_pipeli$
smtpd_sender_restrictions = reject_unknown_sender_domain
smtp_use_tls = yes
smtpd_tls_received_header = yes
smtpd_tls_mandatory_protocols = SSLv3, TLSv1
smtpd_tls_mandatory_ciphers = medium
smtpd_tls_auth_only = yes
tls_random_source = dev:/dev/urandom

virtual_mailbox_base = /home/vmail
virtual_mailbox_maps = hash:/etc/postfix/vmailbox
virtual_mailbox_domains = foobar.com
virtual_minimum_uid = 100
virtual_uid_maps = static:2222
virtual_gid_maps = static:2222
virtual_transport = dovecot
dovecot_destination_recipient_limit = 1

smtpd_sasl_auth_enable = yes
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_security_options = noanonymous
smtpd_sasl_local_domain = $mydomain
smtpd_tls_security_level = may
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_tls_received_header = yes
tls_random_source = dev:/dev/urandom

My postfix' vmailbox file looks like this:

admin@foobar.com             foobar.com/admin/
office@foobar.com            foobar.com/office/

This is my dovecot's local.conf:

protocols = imap imaps
disable_plaintext_auth = no

ssl_cert_file = /etc/ssl/certs/mail.crt
ssl_key_file = /etc/ssl/private/mail.key

mail_location = maildir:/var/mail/vhosts/%d/%n

auth default {
  mechanisms = plain login
  userdb {
    driver = passwd-file
    args = /home/vmail/foobar.com/passwd
    default_fields = uid=vmail gid=vmail home=/home/vmail/%d/%u
  passdb {
    driver = passwd-file
    args = /home/vmail/foobar.com/passwd
  socket listen {
    client {
      path = /var/spool/postfix/private/auth
      mode = 0660
      user = postfix
      group = vmail
    master {
      path = /var/run/dovecot/auth-master
      mode = 0600
      user = vmail
      group = vmail

Here is the link of the guide I followed (in German)

share|improve this question
When you added the virtual_mailbox_maps did you also run postmap on the map files? Anything that requires a hash should have this done. I also wonder about your smtpd_sasl_path setting, as I have mine channeled to inet: for Dovecot to run auths against –  douggro Feb 22 '14 at 2:07
Yes I have run postmap. And I followed a setup guide, so I cannot really tell why the option id strange –  MechMK1 Feb 22 '14 at 11:00
I think your problem is in Postfix with regards to the virtual mailbox config, perhaps with not being able to read the vmailbox map. Have you checked the ownership and privileges for that file? Was that covered in the guide you followed? Maybe edit your post to include a link to the guide. –  douggro Feb 22 '14 at 16:02
The guide is in german, so I believe it will be of limited use. I checked the vmailbox and vmailbox.db file and each have correct privileges –  MechMK1 Feb 22 '14 at 17:15
Try changing the smtpd_recipient_restrictions to permit_mynetworks,permit_inet_interfaces and see if that changes it. Ignore my comment about the `smtpd_sasl_path - I use that for SASL auth for Dovecot on my config. –  douggro Feb 23 '14 at 0:32

Your Answer


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

Browse other questions tagged or ask your own question.