Configure Sendmail as a Smarthost and rewriting the from-address

  1. Install both the sendmail and sendmail-cf packages on your Redhat/CentOs server.  Use the command: yum install sendmail sendmail-cf 
  2. To automatically start sendmail to start on system boot we issue the command: chkconfig sendmail on 
  3. To start sendmail NOW we issue the command: service sendmail start 
  4. Now we edit the file /etc/hosts and make sure the line: <ip address of your central email server> hostname hostname.hostdomain is inserted. 
  5. Now we edit the sendmail configuration file /etc/mail/ with vi using the command: vi /etc/mail/ 
  6. Find the line that reads: dnl #define(`SMART_HOST',`<some ip address of a server found in the file example>') 
  7. Change this line or add an additional line to read as follows: define(`SMART_HOST',`<FQDN of your central email server>') 
  8. In order to rewrite the from address of the email from this particular server create a genericstable file with the following command: vi /etc/mail/genericstable 
  9. Enter the following two lines in to this file as follows:root                root@<this host name and domain>username     <user to email to on the centrail server>@<centrail email server fully qualified domain named>