0

For some reason my Postfix mail server running on CentOS 7 stopped working recently, maybe because I updated the modules through Webmin, I don't know. I am able to send out emails but I am not receiving emails. Also, POP3 and IMAP aren't working. I've tried many things but haven't been able to figure it out by myself, so I am looking for some help.

I read a few threads on the topics:

My initial error: Relay access denied from the file /var/log/maillog:

Jul 31 11:18:40 myhostname postfix/smtpd[6787]: connect from mail-wm0-f51.google.com[74.125.82.51]
Jul 31 11:18:40 myhostname postfix/smtpd[6787]: NOQUEUE: reject: RCPT from mail-wm0-f51.google.com[74.125.82.51]: 454 4.7.1 <contact@mydomain.com>: Relay access denied; from=<myemail@gmail.com> to=<contact@mydomain.com> proto=ESMTP helo=<mail-wm0-f51.google.com>
Jul 31 11:18:41 myhostname postfix/smtpd[6787]: disconnect from mail-wm0-f51.google.com[74.125.82.51]

My initial setting (/etc/postfix/main.cf) running the command postconf -n:

alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
debug_peer_level = 2
debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin ddd $daemon_directory/$process_name $process_id & sleep 5
html_directory = no
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
newaliases_path = /usr/bin/newaliases.postfix
readme_directory = /usr/share/doc/postfix-2.10.1/README_FILES
sample_directory = /usr/share/doc/postfix-2.10.1/samples
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
unknown_local_recipient_reject_code = 550

After reading the articles I mentioned above, I defined mydomain, myhostname and mynetworks; now I get a different error (see below.) Here is the main.cf settings with the alterations:

alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
debug_peer_level = 2
debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin ddd $daemon_directory/$process_name $process_id & sleep 5
html_directory = no
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
mydomain = mydomain.com
myhostname = 9dok43ksalv.hostname.com
mynetworks = 11.22.33.44/28, 127.0.0.0/8
myorigin = $mydomain
newaliases_path = /usr/bin/newaliases.postfix
readme_directory = /usr/share/doc/postfix-2.10.1/README_FILES
relay_domains = $mydestination
sample_directory = /usr/share/doc/postfix-2.10.1/samples
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
unknown_local_recipient_reject_code = 550

Now the error I got is Recipient address rejected: User unknown in local recipient table; as shown below:

connect from mail-wm0-f49.google.com[74.125.82.49]
Aug  1 16:22:27 9dok43ksalv postfix/smtpd[2583]: NOQUEUE: reject: RCPT from mail-wm0-f49.google.com[74.125.82.49]: 550 5.1.1 <contact@mydomain.com>: Recipient address rejected: User unknown in local recipient table; from=<myemail@gmail.com> to=<contact@mydomain.com> proto=ESMTP helo=<mail-wm0-f49.google.com>
Aug  1 16:22:28 9dok43ksalv postfix/smtpd[2583]: disconnect from mail-wm0-f49.google.com[74.125.82.49]

Apparently Postfix isn't finding the final destination for the email. I've never had to configure Postfix before, so I am a bit lost now as a first timer; VestaCP used to take care of this for me, and I never had a problem, until now.

Would someone be kind enough to point me on the right direction. I would really appreciate to receive emails again, and get POP3 & IMAP working.

Thanks in advance. Let me know if you need more information.

Caio Mar
  • 111
  • 1
  • 6
  • You say it was working fine before editing some modules in webmin? Do you have a backup of the config files from before? – Joe Aug 01 '17 at 22:21
  • It was working before upgrading (not editing) the modules as Webmin requests periodically. I am not sure if this is what caused it though, it is my guess, this server has low traffic and I was notified of this problem days after it was updated. No, unfortunately I don't have a backup of the system files, only the projects running on it. What blows my mind is that Postfix was working fine right out of the box when I installed Webmin & VestaCP. – Caio Mar Aug 01 '17 at 23:38

2 Answers2

3

The error message is 550 5.1.1 user unknown in local recipient table

I think you may need to look at the local recipients map/alias maps and ensure that they are configured correctly. Also look at mydestinations value in main.conf as if domain is configured their then local delivery should occur

Worth reading this answer Confused about alias_maps and virtual_alias_maps

Some good info below as well http://www.postfix.org/postconf.5.html#local_recipient_maps

"Local Alias database

When mail is to be delivered locally, the local delivery agent runs each local recipient name through the aliases database. The mapping does not affect addresses in message headers. Local aliases are typically used to implement distribution lists, or to direct mail for standard aliases such as postmaster to real people. The table can also be used to map Firstname.Lastname addresses to login names."

or maybe Virtual Alias Maps

"With this approach, every hosted domain can have its own info etc. email address. However, it still uses Linux system accounts for local mailbox deliveries.

With virtual alias domains, each hosted address is aliased to a local UNIX system account or to a remote address. The example below shows how to use this mechanism for the fossedu.org and linuxelabs.com domains."

https://help.ubuntu.com/community/PostfixBasicSetupHowto#Local_Alias_database

https://help.ubuntu.com/community/PostfixBasicSetupHowto#Postfix_virtual_Aliases_for_separate_domains_and_Linux_system_accounts

mrjamesmyers
  • 296
  • 1
  • 7
  • Yes, that is my problem! Once I removed `$mydomain` from the line that defines `mydestination`, I tried to receive an email and it didn't work. Then I started tracing back to the virtual table of accounts (as you explained, thank you!), only to find out that it isn't managed by VestaCP. So when I was creating email accounts on VestaCP, Postfix wasn't seeing them, thus the 550 error. I also found out that VestaCP only integrates with Exim and it does not support Postfix. Exim was starting on boot, but then Postfix would shut it down and start itself. Yep yep yep... thank you so much guys! – Caio Mar Aug 02 '17 at 21:07
  • Cool, had a few postfix headaches with mydestination in the past so felt your pain :-) – mrjamesmyers Aug 02 '17 at 21:11
  • Yes, a pain in the ass, what it is. I had similar problems with Exim, first it was error 550, then other errors as I attempted to resolve it. No luck. I ended up having to remove and reinstall VestaCP, reconfigure everything, now everything is working as it should, thank goodness! I looked at the `exim.conf` file now, nothing appears to have changed from the previous version; so I don't really know what the problem in the first place was. – Caio Mar Aug 03 '17 at 17:36
1

check this:

Postfix: Recipient address rejected: User unknown in local recipient table

The solution (in that case), as explained b techieb0y, is to remove $mydomain from the line:

mydestination = $mydomain, localhost.$mydomain, localhost
zarvox
  • 111
  • 1
  • 1
  • 5