postfix throwing Recipient address rejected error when configured with virtual_mailbox_domains

1.3k views Asked by At

I have configured postfix to send received email to local LMTP agent using virtual_mailbox_domains parameter it works fine if the received email is received for FQDN of the machine running postfix but if it's for the IP address of the machine then it throws the following error "Recipient address rejected: User unknown in local recipient table". Tried different things but no luck. I would really appreciate any tips on this scenario.

Thanks for your help in advance!

Here is the topology:

                                    IP                  FQDN

Machine A (sending machine)    10.2.20.40           machine-a.test.com
Machine B (Postfix + LMTP)     10.2.20.50           mta.test.com

Machine B is running postfix + custom LMTP.

Example 1 (succeeds)

Send email to [email protected] from Machine A. This use case succeeds and Postfix successfully delivers email to customer LMTP agent listening on localhost's socket.

Success case /etc/postfix/main.cf:
virtual_mailbox_domains = mta.test.com
/etc/postfix/virtual_mailbox_map:
[email protected]   lmtp:inet:127.0.0.1:5678

Example 2 (Failed case)

Send email to [email protected] from Machine A. This case fails and Postfix throws this error in mail.log "NOQUEUE: reject: RCPT from unknown[10.2.20.40]: 550 5.1.1 : Recipient address rejected: User unknown in local recipient table; from= to= proto=ESMTP helo=<[127.0.1.1]>"

Failure case /etc/postfix/main.cf:
virtual_mailbox_domains = 10.2.20.50

/etc/postfix/virtual_mailbox_map:
[email protected] lmtp:inet:127.0.0.1:5678

POSTFIX main.cf (Common config part for both cases):

smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no
append_dot_mydomain = no
readme_directory = no
smtpd_tls_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file = /etc/ssl/private/ssl-cert-snakeoil.key
smtpd_use_tls = yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
inet_interfaces = all
inet_protocols = all
mydestination = localhost
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
recipient_delimiter = +
smtpd_client_restrictions = permit_mynetworks, permit
smtpd_delay_reject = yes
smtpd_helo_required = yes
smtpd_recipient_restrictions = permit_mynetworks, permit, reject_unauth_destination
resolve_numeric_domain = yes
unknown_local_recipient_reject_code = 550
myhostname = mta-machine
virtual_mailbox_maps = hash:/etc/postfix/virtual_mailbox_map
virtual_transport = lmtp:inet:127.0.0.1:5678
2

There are 2 answers

1
Ralf Hildebrandt On

[email protected] is incorrect syntax. user@[10.2.20.50] is what the RFC allows for.

But anyway: Since Postfix says "User unknown in local recipient table", the domain part is considered to be local. Not virtual.

0
Ralf Hildebrandt On

You could try adding:

[10.2.20.50] is_a_virtual_domain
user@[10.2.20.50] someother@address

to virtual_alias_maps and check if it works, but I'm not sure about this at all. @[10.2.20.50] syntax is rather byzantine.