Postfix Maildir virtual_mailbox_maps and virtual_alias_maps with multiple entries

Using Ubuntu 16.04 Xenial / Postfix 3.1.0 I have setup virtual_mailbox_maps with virtual_alias_maps using Maildir. I need Postfix to deliver mail both to an outside email address and to the appropriate Maildir folder(s). Instead, despite my best efforts, Postfix chooses the first match/occurrence. It will either deliver mail to an alias or deliver mail to the Maildir. I have been unable to configure it to do both.

The second part of this issue is that I also need to have one virtual mailbox forward to multiple Maildir locations. For example, I need mail sent to [email protected] to store mail in /home/vmail/mydomain.com/admin/ AND /home/vmail/mydomain.com/backup/ (in addition to forwarding to an outside email address [email protected] as stated above).

Attempting this results in creating a subdirectory within the first Maildir with the name of the second Maildir, storing incoming mail there. I have tried separating the entries using a space, a tab, a comma, and a plus. Each has had the same result, creating a subdirectory in the /vmail/domain.com/user/ folder. With each change, I use postmap and reload Postfix.

I have also tried adding multiple lines for single addresses, but Postfix reads the first occurrence and throws a warning about duplicates.

virtual_mailbox_maps // My attempt using white space separation looks like this:

[email protected]    mydomain.com/admin/   mydomain.com/backup/

Note, the above format works fine for virtual_alias_maps, forwarding to multiple outside email addresses.

I have searched every resource on the internet that I can find, trying various different configurations. My current main.cf configuration follows below. I have temporarily commented out virtual_alias_maps to maintain functionality of my Maildir configuration (aliases always seem to take precedence).

Any advice or assistance in this is greatly appreciated. Please let me know if more information is needed.

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

# See http://www.postfix.org/COMPATIBILITY_README.html -- default to 2 on
# fresh installs.
compatibility_level = 2

# Network settings
myhostname = server.mydomain.com
mydomain = mydomain.com
myorigin = $mydomain
mydestination = localhost
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
inet_protocols = ipv4
mynetworks_style = subnet

# Mail settings
#mailbox_command = /usr/bin/procmail
#mailbox_base = /home/vmail
#mailbox_owner = vmail
home_mailbox = Maildir/
recipient_delimiter = +
#alias_maps = hash:/etc/aliases
#alias_database = hash:/etc/aliases

# Limits
message_size_limit = 20480000
mailbox_size_limit = 1073741824

# Virtual Mailbox settings
virtual_mailbox_domains = /etc/postfix/virtual_domains
virtual_mailbox_base = /home/vmail
virtual_mailbox_maps = hash:/etc/postfix/virtual_mailbox
virtual_minimum_uid = 1000
virtual_uid_maps = static:5000
virtual_gid_maps = static:5000

# Virtual Alias settings
#virtual_alias_domains = /etc/postfix/valias
#virtual_alias_maps = hash:/etc/postfix/virtual_forwarding

# TLS parameters
smtpd_tls_cert_file = /etc/letsencrypt/live/mydomain.com/fullchain.pem
smtpd_tls_key_file = /etc/letsencrypt/live/mydomain.com/privkey.pem
smtpd_use_tls=yes
smtpd_tls_auth_only = yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

#Disable Poodle
smtpd_tls_security_level = may
smtp_tls_security_level = may
smtp_tls_loglevel = 1
smtpd_tls_loglevel = 1
smtpd_tls_mandatory_protocols=!SSLv2,!SSLv3
smtp_tls_mandatory_protocols=!SSLv2,!SSLv3
smtpd_tls_protocols=!SSLv2,!SSLv3
smtp_tls_protocols=!SSLv2,!SSLv3

# Changes to SSL Ciphers
tls_preempt_cipherlist=yes
smtpd_tls_mandatory_ciphers=high
tls_high_cipherlist=ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS
#tls_high_cipherlist=ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:DHE-DSS-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA256:ADH-AES256-GCM-SHA384:ADH-AES256-SHA256:ECDH-RSA-AES256-GCM-SHA384:ECDH-ECDSA-AES256-GCM-SHA384:ECDH-RSA-AES256-SHA384:ECDH-ECDSA-AES256-SHA384:AES256-GCM-SHA384:AES256-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:DHE-DSS-AES128-GCM-SHA256:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES128-SHA256:DHE-DSS-AES128-SHA256:ADH-AES128-GCM-SHA256:ADH-AES128-SHA256:ECDH-RSA-AES128-GCM-SHA256:ECDH-ECDSA-AES128-GCM-SHA256:ECDH-RSA-AES128-SHA256:ECDH-ECDSA-AES128-SHA256:AES128-GCM-SHA256:AES128-SHA256:NULL-SHA256

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

# SMTPD Settings
smtp_sasl_auth_enable = no
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
smtpd_recipient_restrictions = permit_auth_destination,permit_sasl_authenticated,permit_mynetworks,reject_unauth_destination
smtpd_relay_restrictions = permit_mynetworks,permit_sasl_authenticated,defer_unauth_destination,permit_inet_interfaces
smtpd_sasl_local_domain = $myhostname
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth

# Custom settings
allow_percent_hack = no
append_at_myorigin = no

Solution 1:

It looks like virtual_alias_maps might be the answer after all.

You just have to specify it like this in the virtual_alias_maps:

[email protected] [email protected], [email protected]

Of course, You should have [email protected] in the virtual_mailbox_maps.

I found the answer here (example 2): https://workaround.org/ispmail/jessie/types-of-email-domains