When I am trying to send from my postfix server to gmail accounts, I am getting the following error message in logs:
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. xt7si10601581pab.187 - gsmtp (in reply to end of DATA command))
After troubleshoot a lot, I found that this is because "from" address field is not present in email headers generated from my postfix server.
I enabled header check in "/etc/postfix/main.cf" using the line below:
header_checks = regexp:/etc/postfix/header_checks
and added following line to the file :
!/^From:/ REPLACE From: email@example.com
Now, all the mails are being accepted by gmail server. But, now any mails send via my postfix server has from address "firstname.lastname@example.org".
I need a regexp in postfix, which replaces the header with the "from" address to the same from address it has been sent.
In short, I want to generate a mail header with "from" field same as that of from address.