Configuring and Building Sendmail Config Files in Slackware
Sendmail has the reputation of being hard to configure, but there is a Buildscript that does a very good job and eases the task for simple configurations.
If you cd into /usr/share/sendmail/cf/cf you will find quite a few example .mc files to use, including the default slackware files.
Sendmail.cf
Copy one of the .mc files as sendmail.mc and add in any settings that you need to use. Finding the correct settings can be tricky, but sendmail.org has fairly good documentation. I will show you two useful features: relaying to another smtp server (your ISPs for example), and setting sendmail to use trusted users stored in /etc/mail/trusted-users. Having trusted users is useful to get rid of X-Authentication-Warnings. These can come from mail forms on webpages, or because we have changed the envelope (in the muttmanpage see set_envelope_from). For webpage forms you may need to add 'apache', 'httpd' or 'nobody' to the trusted-users file.
For relaying we need to set 'Smart Host':
define(`SMART_HOST', `smtp.someotherserver.com')
And for trusted users:
FEATURE(`use_ct_file')
Next we just have to run the Build script:
./Build sendmail.mc
It will create a new sendmail.cf, hopefully without errors. If you do get errors it's usually not so hard to find the problem by looking at the Build output. A typical error is '*** ERROR: FEATURE() should be before MAILER()'or similar. It just means that the settings are in the wrong order. Rearranging can be simple or not depending on how many custom settings you have added. If you are going to build a really complex sendmail config it may be worth adding in features a few at a time and doing a test build at each step. That should make it easier to debug.
Submit.cf
The same process is used to create the submit.cf file. Sendmail.cf is used by the smtp daemon, while submit.cf is used for commandline applications such as mutt.
Finishing Up
All that is left to do is to copy your sendmail.cf and submit.cf to /etc/mail (backup originals), and then restart sendmail:
cp sendmail.cf submit.cf /etc/mail
/etc/rc.d/rc.sendmail restart
The -f flag changes the envelope from address. If your username is in trusted-users then you shouldn't see any warning in the headers. Now you can also test your webform too.
Next, test that the sendmail daemon is working. My commands are printed inblue, while sendmail's responses are in red (I am testing from the same box that the daemon is running on, so change the IP/Hostname if you are not):
telnet 127.0.0.1 25
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
220 junius.localdomain ESMTP Sendmail ...
HELO localhost
250 junius.localdomain Hello localhost ...
MAIL FROM: root@localhost
250 2.1.0 root@localhost... Sender ok
RCPT TO: you@yourdomain
250 2.1.5 you@yourdomain... Recipient ok
DATA
354 Enter mail, end with "." on a line by itself
Subject: Test message 2
This is a test.
.
250 2.0.0 n2SAWfHb004084 Message accepted for delivery
quit
221 2.0.0 junius.localdomain closing connection
Connection closed by foreign host.
If all went well you should have recieved all test emails without any problems.


