If you’re sending email alerts / notifications from the server using postfix, sender email will be like username@hostname. If you wish to get standard from address, you can follow below steps to do so.
Create the /etc/postfix/sender_canonical, and add user -> email references as shown below
# cat /etc/postfix/sender_canonical
Create /etc/postfix/sender_canonical.db file (encrypted one) using postmap utility.
# postmap hash:/etc/postfix/sender_canonical
Add sender_canonical variable to /etc/postfix/main.cf (which was postfix main configuration file)
# postconf -e “sender_canonical_maps=hash:/etc/postfix/sender_canonical”
To update the changes in postfix, do restart (or) reload postfix configuration
# /etc/init.d/postfix restart|reload
Modify or add first name for a user which will display in your mailbox. Here in this example, I am updating the name for root user.
# chfn -f root
Then enter Full name as you wish which will display as sender’s name in email (Here I am using it as TechieDrone Notifications for root user)
Check postfix version
To identify the postfix version running in your Linux machine, use following command to check
# postconf -d | grep mail_version
Above configuration settings are tested on following postfix versions using Ubuntu machine.
mail_version = 2.11.3
mail_version = 3.1.0
Still having trouble with applying canonical name or alias for your server’s email id, feel free to ask it through comment section 😀