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=<stefan.marcin74@gmail.com> 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.

marhyno
  • 677
  • 1
  • 8
  • 20

2 Answers2

7

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

marhyno
  • 677
  • 1
  • 8
  • 20
  • 3
    [According to Postfix](http://www.postfix.org/LOCAL_RECIPIENT_README.html#format): 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**. – NKSM May 17 '21 at 09:39
  • @NKSM Can you recommend something instead? – Myzel394 Jan 26 '23 at 21:26
0

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 ;)

Radoslav
  • 3
  • 3