Postfix - Recipient address rejected: User unknown in local recipient table
Asked Answered
C

2

8

I am learning (trying) to build my own mail server in Centos 7 VM. I have come to a problem when my incoming mails are getting rejected. Using POSTFIX I am trying to send emails from gmail to my mail but it is stucked by this error. Below I will provide as much information as I can. Btw I dont have any DNS record so I am using IP only. User is John.

[root@mail ~]# cat /etc/aliases
john: john

Output from (postconf -d; postconf -d; postconf -n; ) | sort | uniq -u

mydomain = marhyno.info
myhostname = mail
mynetworks = all
mydestination = localhost.$mydomain, localhost, mail.marhyno.info, <myipo>
smtpd_recipient_restrictions =
    permit_sasl_authenticated
    permit_mynetworks
    reject_unauth_destination
resolve_numeric_domain = yes
relay_recipient_maps =
alias_maps = hash:/etc/aliases                                                                            
allow_mail_to_commands = alias,forward,include
allow_mail_to_files = alias,forward,include
biff = no
html_directory = /usr/share/doc/packages/postfix/html
local_recipient_maps = unix:passwd.byname $alias_maps

Output from tail -f /var/log/maillog

Feb 10 01:26:55 mail postfix/smtpd[7531]: connect from mail-yb0-f173.google.com[209.85.213.173]
Feb 10 01:26:56 mail postfix/smtpd[7531]: NOQUEUE: reject: RCPT from mail-yb0-f173.google.com[209.85.213.173]: 550 5.1.1 <john@<myip>>: Recipient address rejected: User unknown in local recipient table; from=<[email protected]> to=<john@<myip>> proto=ESMTP helo=<mail-yb0-f173.google.com>
Feb 10 01:26:56 mail postfix/smtpd[7531]: disconnect from mail-yb0-f173.google.com[209.85.213.173]

Any help will be appreciated :) Thank you.

Clausen answered 11/2, 2017 at 21:54 Comment(0)
C
8

Solution has been found:

/etc/postfix/main.cf
    local_recipient_maps =

Local recipient maps is enabled by DEFAULT = setting that to empty enables postfix to finally accept message and store it in users file. Also to enable download email to users Outlook - set Chown permissions to the name of the user - e.g. chown john:john /var/spool/mail/john

Also to completely provide solution - change mynetworks = all ... to your home / local subnet ... e.g. my is 192.168.0.0/24

Clausen answered 13/2, 2017 at 23:8 Comment(2)
According to Postfix: That is, an empty value. With this setting, the Postfix SMTP server will not reject mail with "User unknown in local recipient table". Don't do this on systems that receive mail directly from the Internet. With today's worms and viruses, Postfix will become a backscatter source: it accepts mail for non-existent recipients and then tries to return that mail as "undeliverable" to the often forged sender address.Gustin
@Gustin Can you recommend something instead?Airborne
G
1

I found something like:

With regular expression tables, Postfix only queries with the full recipient address, and not with the bare username or the "@domain.tld" wild-card.

Let me know if that was helpful ;)

Grau answered 12/2, 2017 at 20:45 Comment(1)
Not OP, but very useful to me. Especially since alias_map typicall can match a user, I was stumped why my regex aliases were not working. Then I just YOLO added a wildcard at the end, and it worked. I guess this domain thingy is the reason why.Memory

© 2022 - 2024 — McMap. All rights reserved.