To support more domain names and non-system accounts we have recently reconfigured postfix to use virtual domains.
For receiving mail this is working well but when mail is sent it is often marked as spam by receiving mail servers because the mail is marked as coming from 'localhost' rather than the real host/domain name as it was prior to the change to virtual domains.
In main.cf these lines are set:
myhostname = mail.example.com mydomain = example.com myorigin = $mydomain + other settings for virtual domains mydestination is commented out as all domains are virtual.
These seem to make no difference to the sending domain.
Ideally mail should be marked as coming from 'mail.example.com' or 'mail.example2.com' depending on the sending domain. If that is not possible then marking it as coming from anything other than 'localhost' would be fine. Could anyone point out the settings that are missing or wrong please?
EDIT In the received email the 'return path' is correct, 'localhost' occurs in the line:
Received: from localhost ([a.b.c.d]) by mail.receivingserver.com