How to Change Sendmail Sender in CentOS 7

By default, if we email using sendmail then sendmail will make the user and hostname server as the sender address of the email so it becomes [email protected]_server. For example, we email using the root user and our server hostname has the name ngoprek in CentOS 7, then sendmail will write the address of the sender [email protected] For example, I emailed like this using bash script:

If the email is sent to the account [email protected] then the From section will be written [email protected] as in the following picture:
sendmail senderIf the recipient receives the email and wants to reply it then the email will not be sent because the DNS does not know the domain @ngoprek.localdomain located. In order to reply the email that sent from sendmail using the script, then it should be added to the email -r option as in the following example:

So if the email is sent to the recipient, then on the FROM section will be written [email protected] If the recipient wants to reply to the email then the email will be sent because the DNS knows where the domain is located.


Leave a Reply

Your email address will not be published. Required fields are marked *