How to set POSTFIX to handle sending emails only from IPv4 addresses and not from IPv6?
Personally it has happened to me that the virtual server sometimes (yet I have no idea why only sometimes) sends emails from the server via IP version 6 a typically Gmail rejects these emails. Sometimes but sends emails from IP version 4 and everything works correctly.
there are several rules that must be observed for 100% deliverability. These in particular are these:Correct DNS settings
Either in the DNS of the domain always specify the AAAA address to which the domain hosts or in DNS specify the MX record with matching IPv4 and IPv6 address.2) Correct DNS TXT SPF record settings
v=spf1 a mx ~all
Thanks to this setting, the A record and the AAAA record, which determine the "a" directive in the SPF record are seen in DNS as allowed senders. The A and AAAA record of the MX server are checked.
Forcing communication only at the IPv4 level
In Linux it is possible to enforce sending emails only on the IPv4 level very simply. The following line in the file /etc/postfix/main.cfg is enough:
inet_protocols = all
in the following way..
inet_protocols = ipv4
and restart POSTFIX
postfix reload
then we can check whether POSTFIX works correctly..
service postfix status
and it is appropriate after sending the test email to view /var/log/mail.log if the emails were sent without problems.