22

I am trying to set up postfix, but I get a "Temporary lookup failure" error

main.cf:

inet_protocols = ipv4
inet_interfaces = all

queue_directory = /var/spool/postfix
command_directory = /usr/sbin
daemon_directory = /usr/lib/postfix
data_directory = /var/lib/postfix
mail_owner = postfix

myhostname = ns0.dzervas.gr
mydomain = dzervas.gr
myorigin = dzervas.gr
mynetworks_style = host
mydestination = localhost, localhost.$mydomain, $myhostname, $mydomain, mail.$mydomain, www.$mydomain

virtual_mailbox_base = /var/mail/vhost
virtual_mailbox_maps = hash:/etc/postfix/vmailbox
virtual_minimum_uid = 1000
virtual_uid_maps = static:2000
virtual_gid_maps = static:2000
virtual_alias_maps = hash:/etc/postfix/valias

smtp_generic_maps = hash:/etc/postfix/generic

vmailbox:

dzervas@dzervas.gr      dzervas.gr/dzervas
dna@dzervas.gr          dzervas.gr/dna
dzervas@ns0.dzervas.gr  ns0.dzervas.gr/dzervas

valias:

webmaster@dzervas.gr    dzervas@dzervas.gr
hostmaster@dzervas.gr   dzervas@dzervas.gr
postmaster@dzervas.gr   dzervas@dzervas.gr
#dzervas@ns0.dzervas.gr dzervas@dzervas.gr

generic:

dzervas@dzervas.gr      root

telnet testing:

Trying <ip>...
Connected to <ip>.
Escape character is '^]'.
220 ns0.dzervas.gr ESMTP Postfix
ehlo test.com
250-ns0.dzervas.gr
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
mail from: testing@test.com
250 2.1.0 Ok
 rcpt to: dzervas@dzervas.gr
451 4.3.0 <dzervas@dzervas.gr>: Temporary lookup failure
quit
221 2.0.0 Bye
Connection closed by foreign host.

journalctl reports:

May 09 15:09:22 ns0 postfix/smtpd[7754]: error: open database /etc/aliases.db: No such file or directory
May 09 15:09:22 ns0 postfix/smtpd[7754]: warning: dict_nis_init: NIS domain name not set - NIS lookups disabled
May 09 15:09:22 ns0 postfix/smtpd[7754]: connect from <client-ip>
May 09 15:09:43 ns0 postfix/smtpd[7754]: warning: hash:/etc/aliases is unavailable. open database /etc/aliases.db: No such file or directory
May 09 15:09:43 ns0 postfix/smtpd[7754]: warning: hash:/etc/aliases lookup error for "dzervas@dzervas.gr"
May 09 15:09:43 ns0 postfix/smtpd[7754]: NOQUEUE: reject: RCPT from <client-ip>: 451 4.3.0 <dzervas@dzervas.gr>: Temporary lookup failure; from=<testing@test.com> to=<dzervas@dzervas.gr> proto=ESMTP helo=<test.com>
May 09 15:09:52 ns0 postfix/smtpd[7754]: disconnect from <client-ip>

I should point out that I haven't set up the DNS records yet (dzervas.gr is not pointing my new server yet) Also I'm on arch linux x86_64

EDIT: I created an empty /etc/aliases and then newaliases new problem (in telnet):

rcpt to: dzervas@dzervas.gr
550 5.1.1 <dzervas@dzervas.gr>: Recipient address rejected: User unknown in local recipient table

but!:

rcpt to: root@localhost
250 2.1.5 Ok
data
354 End data with <CR><LF>.<CR><LF>
hhahahahha
.
250 2.0.0 Ok: queued as <some-code>

EDIT 2: solved the Recipient address rejected: User unknown in local recipient table by setting local_recipient_maps = in main.cf However, now my mail to dzervas@dzervas.gr get queued! it does not go at /var/mail/vmail/dzervas.gr/dzervas/ as it should!

3
  • If you're looking to test a mailserver, a functioning DNS entry is a pretty fundamental piece. Postfix is looking to see if dzervas.gr is configured.. get your DNS working then test. – NickW May 9 '13 at 12:20
  • ok, thank you. does the setup seems correct to you? – dzervas May 9 '13 at 12:36
  • It's awfully simple, but it's a start. – NickW May 9 '13 at 12:52
6

Run newaliases . If /etc/aliases doesn't exist then create it first, then run newaliases .
Also maybe update/add alias_maps = hash:/etc/aliases to /etc/postfix/main.cf to get rid of the other warning.
Then try again.
(If you test with telnet, you don't need working DNS).


2nd issue: First remove $myhostname, $mydomain, from mydestination, since virtual domains shouldn't be listed here.
Then add (to main.cf):

virtual_mailbox_domains=dzervas.gr

Reload postfix and try again.

5
  • 1
    You were right! I created an empty /etc/aliases and then newaliases. New problem arouse... – dzervas May 9 '13 at 22:48
  • Edited my post . – Sandor Marton May 10 '13 at 0:48
  • thank you soooo much! PS: I had to create and chown the /var/spool/mail/vmail/ directory (just for reference) – dzervas May 10 '13 at 10:02
  • Fixed my problem after a server reboot running Sentora/zPanel panel, thanks. – Arvy Jul 24 '19 at 18:25
  • thanks, issue solved in 2nd issue solution – Fernando Torres Sep 13 '19 at 20:54
18

mynetworks needs strict network ranges

In my case, there was a wrong ip range in /etc/postfix/main.cf.

# Wrong; Temporary lookup failure
mynetworks = 172.16.0.0/8
# OK
mynetworks = 172.16.0.0/12

There was an error in /var/log/maillog that I noticed later.

Oct 4 13:47:54 postfix/smtpd[25056]: warning: non-null host address bits in "172.16.0.0/8", perhaps you should use "172.0.0.0/8" instead

If someone comes here from the top hit on google with searching Temporary lookup failure, I'd say please dubble-check your $mynetworks format.

4
  • 4
    Thnx, that was the solution to my problem. Also not OK: 172.16.0.1/12 – f4der Jan 15 '18 at 16:41
  • 3
    Also was my issue. 172.19.0.1/24 is not OK either. – Rohn Adams Jun 26 '19 at 15:12
  • 2
    This, 127.0.0.1/8 is what got me. – zypA13510 Dec 17 '19 at 7:54
  • yes, this problem just bit me in the ass, and while searching for the solution after the fact, I came across this answer. – pdwalker Nov 26 '20 at 6:17
0

My 5 cents:

I did changed main.conf, but I forgot to reload postfix.

after reload it worked.

0

If your main.cf contains a hash path like so:

virtual_mailbox_domains=hash:/etc/postfix/virtual_mailbox_domains

(containing mydomain.tld OK)

...make sure to create the expected /etc/postfix/virtual_mailbox_domains.db using postmap virtual_mailbox_domains

Not the answer you're looking for? Browse other questions tagged or ask your own question.