Im am trying to send mail using Postfix, but I get the following error for all emails:

May 13 12:44:46 myhost postfix/qmgr[12169]: A6D9644526: from=<x@y.com>, size=317, nrcpt=1 (queue active)

May 13 12:44:46 myhost postfix/smtp[12178]: A6D9644526: to=<z@gmail.com>, relay=none, delay=0.03, delays=0.02/0/0/0, dsn=4.4.3, status=deferred (Host or domain name not found. Name service error for name=gmail.com type=MX: Host not found, try again)

Reading the linked questions, I have already checked /etc/resolv.conf and /var/spool/postfix/etc/resolv.conf they both are same. my resolv.conf looks like :

nameserver 2001:4b98:dc0:49::225
options timeout:1 attempts:3 rotate

dig mx gmail.com works:

; <<>> DiG 9.9.5-3ubuntu0.8-Ubuntu <<>> mx gmail.com ;; global
 options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status:
 NOERROR, id: 64383 ;; flags: qr rd ra; QUERY: 1, ANSWER: 5, AUTHORITY:

Here is the content of /etc/postfix/main.cf:

smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no

append_dot_mydomain = no

readme_directory = no

smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = myhost
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mynetworks = [::ffff:]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = ipv4

Any idea why the mail host is not found?


It seems the error was due to the ipv6 address in /etc/resolv.conf. I removed it and it now works.

  • 1
    How did it get there in the first place? If it is was through dhcp it will come back. – Rui F Ribeiro May 13 '16 at 11:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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