1

So mysteriously my previously-working MailHog stopped working this morning on my Mac Mojave.

I have followed the steps in this post to get MailHog running: https://www.joshstauffer.com/send-test-emails-on-a-mac-with-mailhog/

Postfix log file output: (log stream --predicate '(process == "smtpd") || (process == "smtp")' --info) Postfix log file output

My /etc/hosts file contains an entry for: 127.0.0.1 localhost

Also when I do the following I get (not sure if it's related):

[12:26:22][~]#nslookup localhost  
Server:     192.168.0.1 
Address:    192.168.0.1#53

** server can't find localhost: NXDOMAIN

My last section (previous all unchanged) of etc/postfix/main.cf config file:

#inet_protocols = all
inet_protocols = ipv4
message_size_limit = 10485760
mailbox_size_limit = 0
biff = no
mynetworks = 127.0.0.0/8, [::1]/128
smtpd_client_restrictions = permit_mynetworks permit_sasl_authenticated permit
recipient_delimiter = +
tls_random_source = dev:/dev/urandom
smtpd_tls_ciphers = medium
inet_interfaces = loopback-only

# Adding this doesnt work:
#mydestination = localhost

# For MailHog
myhostname = localhost
relayhost = [localhost]:1025
compatibility_level = 2

Tried adding inet_protocols = ipv4 according to this post.

Any help much appreciated!

gvanto
  • 63
  • 6
  • Show your `/etc/hosts` and Firewall settings. Address queries for `localhost.` [*should always* return](https://datatracker.ietf.org/doc/html/rfc6761#section-6.3) the IP loopback address. – anx Apr 17 '22 at 21:06

1 Answers1

1

By default Postfix only uses DNS to resolve names, bypassing any system resolving configuration (hosts file, ldap, etc). To use the native system resolving, set the following configuration option:

smtp_host_lookup=native

Or to fallback on the native option if the record is not found in DNS.

smtp_host_lookup=dns,native

Root DNS servers are not allowed to return any records for localhost because it's reserved. But depending on your on premise DNS solution or ISP you might still get a record for it though.

basvdlei
  • 1,326
  • 8
  • 13