In postfix 2.6 and above, we have to add a parameter in postfix "main.cf" file to automatically add mail headers to outgoing mails.
By default, in postfix version 2.6 and above mails headers are not added. Hence the mails that are relayed through postfix server may be rejected by gmail server. The error generated in the logs will be similar to the one below:
Our system has detected that this message is 550-5.7.1 not RFC 2822 compliant. To reduce the amount of spam sent to Gmail, 550-5.7.1 this message has been blocked. Please review 550 5.7.1 RFC 2822 specifications for more information.
Now, inorder to solve this add the following parameter to "/etc/postfix/main.cf ".
always_add_missing_headers = yes
Restart, postfix server. Once done, the mails generated or relayed through postfix server will have mail headers attached to it. Hence gmail servers, will start accepting the mails.