I try to set up a mail server on Ubuntu using Postfix, Dovecot and LDAP. So far I can send and receive mails with Postfix and can connect to Dovecot via telnet (port 143) with an LDAP user.

As a next step I would like to configure Dovecot as my LDA as suggested in the book Postfix by R. Hildebrandt and P.B. Koetter. Up till now, however Postfix tries to use the local deamon to deliver mails to a local recipient.

So far, I configured the following (actual domain is replaced by example.com):

Activate dovecot deliver in /etc/dovecot/conf.d/15-lda.conf:

protocol lda {
  postmaster_address = postmaster@example.com

service auth {
  unix_listener auth-master {
    mode = 0600
    user = vmail

Setup dovecot in /etc/postfix/master.cf:

dovecot   unix  -       n       n       -       -       pipe
  flags=ODRhu user=vmail:vmail argv=/usr/lib/dovecot/deliver -e -f ${sender} -d ${recipient}

Configured virtual transport in /etc/postfix/main.cf:

virtual_transport = dovecot
dovecot_destination_recipient_limit = 1

When I issue the command echo foo | /usr/sbin/sendmail -f ttester@dtvvolleyball.de ttester@dtvvolleyball.de I receive the following log output:

postfix/qmgr[25582]: 2AA0060E36: from=<ttester@example.com>, size=272, nrcpt=1 (queue active)
postfix/local[26102]: 2AA0060E36: to=<ttester@example.com>, relay=local, delay=0.01, delays=0.01/0/0/0, dsn=5.1.1, status=bounced (unknown user: "ttester")

The user ttester exists in the LDAP tree and can be found by Dovecot. E.g., if I issue the deliver command manually the mail is sent. However, only if a do not specify the domain:

/usr/lib/dovecot/deliver -e -f ttester@example.com -d ttester

To summarize the issue, I suspect that for some reason Postfix does not delegate the delivery to Dovecot. Any help is highly appreciated.

Thanks in advance!

Here is what postconf -n produces:

alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
config_directory = /etc/postfix
inet_interfaces = all
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
mydestination = $mydomain, $myhostname, localhost, localhost.$mydomain
myhostname = mail.example.com
mynetworks = [::ffff:]/104 [::1]/128
myorigin = /etc/mailname
readme_directory = no
recipient_delimiter = +
relayhost =
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
smtpd_data_restrictions = reject_multi_recipient_bounce
smtpd_helo_required = yes
smtpd_recipient_restrictions = reject_non_fqdn_recipient reject_non_fqdn_sender reject_unknown_recipient_domain reject_unknown_sender_domain permit_mynetworks reject_sender_login_mismatch reject_unauth_destination check_recipient_access hash:/etc/postfix/roleaccount_exceptions reject_multi_recipient_bounce reject_non_fqdn_helo_hostname reject_invalid_helo_hostname check_helo_access pcre:/etc/postfix/helo_checks check_sender_mx_access cidr:/etc/postfix/bogus_mx permit
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
smtpd_tls_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file = /etc/ssl/private/ssl-cert-snakeoil.key
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_use_tls = yes
virtual_transport = dovecot
  • Using dovecot's deliver directly gives a reject, but using postfix via sendmail succeeds. Are you sure the user ttester exists in LDAP without the domain part? postfix usually adds it and succeeds without, while it does not work without. – sebix Jun 5 '15 at 19:22
  • Please edit your question and post the output of postconf -n – masegaloeh Jun 6 '15 at 2:01
  • Thanks for your responses! @sebix I am sure that the user ttester exists in LDAP without the domain part, but I doubt postfix via sendmail fails, too. @masegaloeh I added the output of postconf -n above. – Andreas Hahne Jun 6 '15 at 8:46

Postfix will use address classes to determine which domain class and its transport to deliver an email.

Based on your postconf output, the $domain/example.com is listed in mydestination, so it will use local address classes and use $local_transport parameter (run postconf local_transport) to deliver the email.

That's why virtual_transport was ignored by postfix. The proposed solution is remove $mydomain from mydestination and put it in virtual_mailbox_domains.

  • Excellent, thank you! Adding the virtual_mailbox_domains did the trick. I did not dare to remove $mydomain from mydestination before. – Andreas Hahne Jun 10 '15 at 18:58
  • What's the function of postmaster_address = postmaster@example.com? even I delete it, mail sever still work well. – kittygirl Oct 29 '18 at 7:37

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.