Hi,
I have managed to setup postfix on alma linux 9 to forward email via gmail server but the only problem the name appear to be root. So I change the hostname via this command hostnamectl set-hostname alamtestnet
but yet it appears as root in the received emails.
Can you provide the script or one-liner you use to generate the email?
Can you provide an image snippet of what the unwanted result looks like?
That might help us.
Hi,
This the script I am testing
echo "Test Postfix Gmail SMTP Relay " | mail -s “Postfix Gmail SMTP Relay 1” ****@gmail.com
I would expect to see root@localhost
or root@alamtestnet
as sender, if you send mail as user root
. To see ‘root’ where a hostname is expected – you have to tell more.
It’s been more than a decade since I did this, but if you add “-r testaddr@somedomain.com” (without the quotes) to the mail command before the “-s” that should set a from address. That from address must be a real address (and domain).
“mail --help” will show the command syntax.
Perhaps one should append to /etc/postfix/generic
a mapping, like:
root@alamtestnet.localdomain testaddr@somedomain.com
and rehash the map to use:
postmap /etc/postfix/generic
One probably has to add hash:/etc/postfix/generic
to smtp_generic_maps
in postfix config first.
Overall, postfix should have many options in its config. (The above is the only one that I have had a need for.)
To ensure that you do not appear as root when sending the email, do the following on your server:
Install the package below
# yum install mutt-2.2.6-2.el9.x86_64
Once installed, edit the file as below:
# vim /etc/Muttrc
Uncomment the line below
# set realname=“”
leaving it this way
set realname=“yourserver.yourdomain”
Save the file and test sending the email as below:
echo “Postfix Test…” | mutt -s ‘[SRV-SERVER]’ e-mail@seuemail.com.br*