We currently run postfix version 2.3.3 using hash files to store virtual domain and virtual user information. We are trying to convert this system to use a mysql database where the information is stored and getting a strange error. It appears that the system is delivering the message to the local recipient, but also failing to deliver it simultaneously:
Jun 20 14:53:15 psmtp-3 postfix/smtpd[8668]: connectfromsending.server.com[x.x.x.x] Jun 20 14:53:16 psmtp-3 postfix/smtpd[8668]:26F9E2763F:client=sending.server.com[x.x.x.x] Jun 20 14:53:16 psmtp-3 postfix/cleanup[8671]: 26F9E2763F: message-id= Jun 20 14:53:16 psmtp-3 postfix/qmgr[8667]: 26F9E2763F: from=,size=847,nrcpt=2 (queue active) Jun 20 14:53:17 psmtp-3 postfix/smtpd[8668]: disconnectfromsending.server.com[x.x.x.x] Jun 20 14:53:17 psmtp-3 postfix/error[8672]: 26F9E2763F:to=<virt...@virtualdomain.net>, relay=none,delay=1.7,delays=1.7/0.01/0/0.02, dsn=5.0.0, status=bounced (User unknownin virtual alias table) Jun 20 14:53:17 psmtp-3 postfix/local[8673]: 26F9E2763F:to=<lo...@localdomain.net>,orig_to=<virt...@virtualdomain.net>,relay=local, delay=1.8,delays=1.7/0.01/0/0.12, dsn=2.0.0, status=sent(delivered to maildir) Jun 20 14:53:18 psmtp-3 postfix/cleanup[8671]: 1B6EC27644: message-id=26F9E2763F Jun 20 14:53:18 psmtp-3 postfix/qmgr[8667]: 1B6EC27644: from=,size=2716,nrcpt=1 (queue active) Jun 20 14:53:18 psmtp-3 postfix/bounce[8674]: 26F9E2763F:sendernon-delivery notification: 1B6EC27644 Jun 20 14:53:18 psmtp-3 postfix/qmgr[8667]: 26F9E2763F: removed As you can see the server bounces the message to the virtual user virt...@virtualdomain.net, then accepts the same message for the same virtual user and delivers it correctly to the local user. Here are my configs: virtusertable.mappings.cf hosts = host user = user password = pass dbname = virtusertable query = SELECT address, destination FROM mappings WHERE address = '%s' local-host-names.cf: hosts = host user = user password = pass dbname = virtusertable query = SELECT DISTINCT domain FROM mappings WHERE domain = '%s' AND domain NOT LIKE 'localdomain.net' main.cf: soft_bounce = no queue_directory = /var/spool/postfix command_directory = /usr/sbin daemon_directory = /usr/libexec/postfix mail_owner = postfix default_privs = nobody #myhostname = host.domain.tld myhostname = smtp.localdomain.net mydomain = localdomain.net #myorigin = $myhostname myorigin = $mydomain inet_interfaces = all #inet_interfaces = $myhostname #inet_interfaces = $myhostname, localhost #inet_interfaces = localhost #proxy_interfaces = #proxy_interfaces = 1.2.3.4 #mydestination = $myhostname, localhost.$mydomain, localhost mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain #mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain, # mail.$mydomain, www.$mydomain, ftp.$mydomain #local_recipient_maps = mysql:/etc/postfix/local-recipient-maps.cf local_recipient_maps = unix:passwd.byname $alias_maps #local_recipient_maps = proxy:unix:passwd.byname $alias_maps unknown_local_recipient_reject_code = 550 #mynetworks_style = class #mynetworks_style = subnet #mynetworks_style = host #mynetworks = 168.100.189.0/28, 127.0.0.0/8 mynetworks = hash:/etc/postfix/mynetworks #mynetworks = hash:/etc/postfix/network_table #relay_domains = $mydestination #relayhost = $mydomain #relayhost = [gateway.my.domain] #relayhost = [mailserver.isp.tld] #relayhost = uucphost #relayhost = [an.ip.add.ress] #relay_recipient_maps = hash:/etc/postfix/relay_recipients #in_flow_delay = 1s #alias_maps = dbm:/etc/aliases alias_maps = hash:/etc/aliases, hash:/etc/postfix/aliases.lists #alias_maps = hash:/etc/aliases, hash:/etc/postfix/aliases #alias_maps = hash:/etc/aliases, nis:mail.aliases #alias_maps = netinfo:/aliases #alias_database = dbm:/etc/aliases #alias_database = dbm:/etc/mail/aliases alias_database = hash:/etc/aliases, hash:/etc/postfix/aliases.lists #alias_database = hash:/etc/aliases, hash:/opt/majordomo/aliases #virtual_alias_domains = hash:/etc/postfix/local-host-names-dynamic virtual_alias_domains = mysql:/etc/postfix/local-host-names.cf #virtual_alias_maps = hash:/etc/postfix/virtusertable.users, hash:/etc/postfix/virtusertable.mappings, hash:/etc/postfix/virtusertable.aliases, hash:/etc/postfix/aliases virtual_alias_maps = mysql:/etc/postfix/virtusertable.users.cf, mysql:/etc/postfix/virtusertable.mappings.cf, mysql:/etc/postfix/virtusertable.aliases.cf, hash:/etc/postfix/aliases canonical_maps = hash:/etc/postfix/canonical #recipient_delimiter = + #home_mailbox = Mailbox home_mailbox = Maildir/ #mail_spool_directory = /var/mail mail_spool_directory = /var/spool/mail #mailbox_command = /some/where/procmail #mailbox_command = /some/where/procmail -a "$EXTENSION" #mailbox_transport = lmtp:unix:/var/lib/imap/socket/lmtp #mailbox_transport = cyrus #fallback_transport = lmtp:unix:/var/lib/imap/socket/lmtp #fallback_transport = #luser_relay = $u...@other.host #luser_relay = $lo...@other.host #luser_relay = admin+$local #header_checks = regexp:/etc/postfix/header_checks #fast_flush_domains = $relay_domains #smtpd_banner = $myhostname ESMTP $mail_name #smtpd_banner = $myhostname ESMTP $mail_name ($mail_version) smtpd_client_connection_count_limit = 100 #local_destination_concurrency_limit = 2 #default_destination_concurrency_limit = 20 debug_peer_level = 2 message_size_limit = 41943040 #debug_peer_list = 127.0.0.1 #debug_peer_list = some.domain debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin xxgdb $daemon_directory/$process_name $process_id & sleep 5 sendmail_path = /usr/sbin/sendmail.postfix newaliases_path = /usr/bin/newaliases.postfix mailq_path = /usr/bin/mailq.postfix setgid_group = postdrop html_directory = no manpage_directory = /usr/share/man sample_directory = /usr/share/doc/postfix-2.3.3/samples readme_directory = /usr/share/doc/postfix-2.3.3/README_FILES recipient_bcc_maps = hash:/etc/postfix/recipient_bcc, hash:/etc/postfix/recipient_bcc_jatheon berkeley_db_read_buffer_size = 262144