Postfix change sender domain

Out of the box postfix is sending emails using the domain name that is returned by the following command in the linux shell:

uname -n

In this case, the sender is the system user that runs the script.

An example could be [email protected].

In order to change the domain that will appear in sent letters and the name of the user from whom the sending is made, you need to edit the file /etc/postfix/main.cf with the following line:

smtp_generic_maps = hash:/etc/postfix/generic

After that, edit the file /etc/postfix/generic

Then run the following:

postmap /etc/postfix/generic

And restart postfix for the changes to take effect:

service postfix restart