andrew_fysh@yahoo.com.au wrote:
> Hi,
>
> I am new to postfix and I am having problems with address
> translations, both internal and external. The server is a BMS /
> database system and only ever sends mail out. It never needs to
> receive mail. A lot of ditribution lists are set up in the aliases
> file, and I have run postalias /etc/aliases
>
> In main.cf I have:
>
> mydomain = companydomain.com.au
>
> I have an alias as follows:
>
> mylocalusername: firstname.lastname@companydomain.com.au
> mygroup: mylocalusername, my.privateaddress@privatedomain.com.au
>
> If I "mailx mygroup" syslog show that it tried to send it to
> mygroup@companydomain.com.au which does not exist. It has not
> translated it to firstname.lastname@companydomain.com.au, so it is not
> received at either address
>
> If I "mailx mylocalusername@localhost I receive the message, but the
> envelope recipient address is mylocalusername@companydomain.com.au
>
> If I "mailx my.privateaddress@privatedomain.com.au" the message is
> received and the envelope recipient is correct, however the sender
> address is mylocalusername@companydomain.com.au
>
> Can someone please point me in the right direction as to how to get
> the correct recipient address and envelope address when using aliases?
> We also use aliases that consist of multiple external addresses (for
> customer invoices etc).
>
> Regards,
> Andrew
Aliases do not change where you message came from, and they don't rewrite
botched or incomplete headers. They only direct the message elsewhere.
This especially applies to when you just run "mailx mygroup". Unless you
have some sort of rewriting setup, messages sent from a shell command will
default to your login username@ either the hostname (not even always a
FQDN) or any special default set in the mailserver.
Check out this section of the postfix docs
http://www.postfix.org/ADDRESS_REWRITING_README.html
It covers what I suspect is the behavior you want.