On our Redhat installation we will find sendmail's configuration file as /etc/sendmail.cf. If you download and compile sendmail you would find it in /etc/mail/sendmail.cf. However, we stay with the former. Redhat 7 comes with sendmail version 8.11.0-8.
To configure sendmail you have basically 2 options. Either you edit the sendmail.cf file directly or you create the sendmail.cf from a m4 file such as sendmail.mc. Sendmail uses the macro language m4 to create the configuration file from an easier to read .mc file. I highly recommend using the latter approach in order to keep administration of this configuration overseeable. Our version of sendmail is already configured well so we don't have to change anything.
However, to explain the process I will list the steps to procuce a custom sendmail.cf file. Don't do this right now please, just save it for later reference! Redhat comes with a working configuration from the file redhat.mc. We will use this file as our template and modify it to our needs. This file should reside in /usr/lib/sendmail-cf/cf/. If you can't find it there you can search for it by typing
cd /
find name *.cf
Now let's copy the template to a new file sendmail-config.mc by typing
cp /usr/lib/sendmail-cf/cf/redhat.mc /usr/lib/sendmail-cf/cf/sendmail-conf.mc
Now we edit the file by typing
vi /usr/lib/sendmail-cf/cf/sendmail-conf.mc
Now we add the following lines to our configuration file. Please note that some of these settings might not be suitable for your configuration or use:
MASQUERADE_AS(organicbrownsuger.com)dnl
# mails always appear to come from
# this domain
Define('confMAX_MESSAGE_SIZE','3145728')dnl
# maximum message size of ~3Mb
Now we create the a file readable by sendmail with
cd /usr/lib/sendmail-cf/cf
sh Build sendmail-conf.cf
Isn't it easy? Now we create a backup copy of our current sendmail.cf file (just in case we messed up) and copy our new file over the old one.
cp /etc/sendmail.cf /etc/sendmail.cf.original
cp /usr/lib/sendmail-cf/cf/sendmail-conf.cf /etc/sendmail.cf
Now we're almost there. For sendmail to know what the local email domain is, we have to configure the file /etc/mail/local-host-names by typing
vi /etc/mail/local-host-names
and appending the lines
organicbrownsugar.com
us.organicbrownsugar.com
to it. Now we're done. To activate the changes we restart sendmail. We will use the init script, just like explained when configuring DNS for automatic startup in 3.4.
/etc/rc.d/init.d/sendmail restart
If we didn't get an error message here it at least means that our configuration file is ok. Now let's see if we can actually use sendmail as we would like to.