I just installed Postfix on my ubuntu, on a local network.

On this network, I have an Exchange Server (using domain mail.example.com). I had a problem sending an email to a local address : adress@example.com :

relay=none, delay=0.01, delays=0.01/0/0/0, dsn=4.3.5, status=deferred 
(Host or domain name not found. Name service error for name=example.com
type=AAAA: Host found but no data record of requested type)

I solved this problem using relay_domain in my postfix main.cf :

relay_domains = example.com
transport_maps = hash:/etc/postfix/transport

And in my /etc/postfix/transport :

example.com smtp:[mail.example.com]

Now I can send mails on @example.com, and I have tested some majors webmails (Gmail, Yahoo, Hotmail...). It works.

But why I got this error on my adresses "@example.com" ? How can I be sure I never find this error on another domain ?

My postconf -n give :

alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
config_directory = /etc/postfix
inet_interfaces = all
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
mydestination = SRVWEB, localhost.localdomain, localhost
myhostname = SRVWEB
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
myorigin = /etc/mailname
readme_directory = no
recipient_delimiter = +
relay_domains = mutuelle-var.fr
relayhost =
smtp_generic_maps = hash:/etc/postfix/generic
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
smtpd_tls_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file = /etc/ssl/private/ssl-cert-snakeoil.key
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_use_tls = yes
transport_maps = hash:/etc/postfix/transport
  • Could you add output of the postconf -n to the question? – ALex_hha Feb 20 '14 at 19:05
  • Are you using ipv6? – ALex_hha Feb 21 '14 at 8:15
  • I changed postfix config to use only ipv4 for now. Wait and see.. – Vincent LITUR Feb 21 '14 at 8:57
up vote 28 down vote accepted

Your server is trying to use IPv6 when sending the mail. Since the mail.example.com doesn't have an AAAA-record (which is the same as an A-record, but for IPv6), that isn't working.

If you want Postfix to never use IPv6, you can change that in the config file, as explained in the postconf(5) man page:

When IPv6 support is enabled via the inet_protocols parameter,  Post-
fix will do DNS type AAAA record lookups.

When  both IPv4 and IPv6 support are enabled, the Postfix SMTP client
will attempt to connect via IPv6 before attempting to use IPv4.

Examples:

inet_protocols = ipv4
inet_protocols = all (DEFAULT)
inet_protocols = ipv6
inet_protocols = ipv4, ipv6

If you want to change it for this domain only, change your transport map to read

example.com smtp-ipv4:[mail.domain.com]
  • Thanks for this explanation ! I read a documentation in French which said that ipv4 was the DEFAULT configuration.. I put ipv4 now, and I have reloaded Postfix, seems to work. Thanks again ! – Vincent LITUR Feb 21 '14 at 8:57
  • It depends on which version of Postfix you're using - I don't recall which version defaults to which, but I know they changed it around at least once. – Jenny D Feb 21 '14 at 8:57
  • 5
    It's not the connection that fails, but the DNS lookup that precedes it. When I have inet_protocols = all it does not attempt an A lookup if an AAAA lookup fails, which seems pointless. Also, if you change this value, you must restart postfix, not just reload. – Synchro Feb 26 '15 at 11:51

The simple Postfix configuration that worked for me.

/etc/postfix/main.cf

myhostname = localhost.testing.com
myorigin = testing.com
relayhost =
inet_protocols = ipv4
inet_interfaces = loopback-only
mydestination =

The following change in /etc/postfix/main.cf solved the problem for me.

inet_protocols = ipv6 

Change the above to

inet_protocols = all
  • 8
    Doesn't add much to the accepted answer, and, to be frank, is useless without JennyD's post which provides the explanation. – Deer Hunter Nov 12 '14 at 9:27

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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