When you send mail using Postfix through command line or similar way, it shows sender's e-mail address root@domain-name. You do not want this and you want your defined email should be visible in recipient's mailbox. Follow the steps.
Add following line in the file /etc/postfix/main.cf
Add your 'from address' and 'the address you want to be seen in place of from address' in this file.
Example :
Now Run following commands in terminal.
Add following line in the file /etc/postfix/main.cf
smtp_generic_maps = hash:/etc/postfix/generic
Now edit the file /etc/postfix/generic, if it is not there, create it.Add your 'from address' and 'the address you want to be seen in place of from address' in this file.
Example :
root@domain.com linuxamination@gmail.com
user1@domain.com linuxamination@gmail.com
You can define different mail addresses for each user of Linux. Now Run following commands in terminal.
postmap /etc/postfix/generic
andservice postfix restart
Now it displays linuxamination@gmail.com as sender, when I send mail as a root or user1.echo "content-of-the-mail" | mail -s "subject-of-the-mail" "recipient@mail-address.com"
Inbox still shows it as root.
ReplyDeletefrom: root[linuxamination@gmail.com]
To change the firstname in mail, you need to follow one of these methods.
ReplyDelete1) Either send mail with -r tag
echo "content-of-the-mail" | mail -s "subject-of-the-mail" -r 'First Last ' "recipient@mail-address.com"
2) or change the full name of user using
chfn -f "firstname lastname" username