*** NOTE: This may not necessarily be the best way to configure Sendmail; I’m certain that it isn’t the only way. It worked for me; if you are in the same situation – home machine, intermittent Net connection, possibly multiple users on one machine – it will probably work for you… but there are no guarantees: if it breaks, you get to keep both pieces. ***
This weekend, I installed RedHat 6.2 on my brother’s PC – just to give an idea of how far we’ve come, I didn’t even have to convince him (well, a few hints about « Oh, your machine crashed again? Gee, mine doesn’t… » over the years may have helped.) I’m a Debian guy, myself, but he had a RedHat CD, and I wanted the experience of completely configuring an RH system (Famous Last Words: « After all, how different could it be? »)
As a matter of fact, the RH install died a few times, until I figured out that one of the non-critical files on the CD was damaged (my brother was very impressed by the fact that I could customize the installation to the extent of eliminating a single file). So, no desktop pictures for the moment – I got them later from ftp.redhat.com – but everything else went well. In a couple of hours, I had his machine up and working away.
The first problem came from the fact that his ISP, AT&T, uses CHAP authentication; not the easiest thing in the world to handle (for those of you who are curious: on the « Advanced » tab of the account properties, select « Let PPP do all authentication » ; close the Configuration Tool; in « /etc/ppp/chap-secrets », put the password in double quotes. That cost me a couple of hours.) Once that was done, everything went smoothly… until I wanted to send mail without using Netscape (I far prefer Mutt). Then, the circus pulled into town, clowns and jugglers and magicians and all…
« He who has never configured `sendmail.cf’ has no courage. He who has configured
it more than once has no brain. »
I’ve always considered hacking sendmail config files to be the province of ÜberHackers, the people who read raw binary code and laugh about it. A « smail » installation – a one-line change in a simple file – MTA setup the easy way! Well… I figured I’d at least give it a shot; I already have lots of scars, what else could I lose? (I hear a chorus of voices: « Your sanity! » Never had any; can’t be a problem.)
I’ll lightly skip over the gnashing of teeth and the anguished screaming at the total lack of useful info on the Net (every Sendmail expert, everywhere and everywhen, thinks that you’re configuring a 50,000-user MTA. There are no exceptions.), and go on to the actual things that worked. Here they are, step by step – note that you’ll need to be `root’ for all of this:
1. Install the « sendmail-cf » package. It’s on the RedHat CD, but does not get installed by default; you’ll need it to make any configuration changes.
2. In `/etc/mail’, create two files – « genericsdomain » and « genericstable » (we’ll be using them in just a minute); in `/etc/mail/Makefile’, add « genericsdomain.db » and « genericstable.db » to the « all: » line.
3. Write your FQDN (Fully Qualified Domain Name – run « hostname -f » to see what it is) in « genericsdomain ». Adding « localhost » doesn’t hurt anything either, and seems like a good idea – this is the file used by Sendmail to determine if the mail it sees is
coming from the local domain.
4. Write (this is the good part) your mail aliases in « genericstable », in a
« local_login_name remote_account_name@mail_domain » format, like so:
5. Run « make » in `/etc/mail’; this will create the « .db » versions of what you’ve just created. Re-run it whenever you change those files.
OK, we’re done with the simple part. Now, before you do the stuff that follows, dance naked widdershins around your computer three times while chanting, « I shall not fear; fear is the mindkiller… » Oops – sorry, that part is optional for anyone but me…
6. Edit `/etc/sendmail.mc’. Add the following lines (I prefer to put them at the end of the other « FEATURE » statements, just for neatness’ sake):
FEATURE(genericstable, `hash -o /etc/mail/genericstable’)
This tells Sendmail to use those files you’ve just created, and to modify the « envelope » (The « From » header, etc.) as well as the visible headers (« From: », etc.)
7. Run « m4 /etc/sendmail.mc > /etc/sendmail.cf ». This processes your newly modified « sendmail.mc » into a form that Sendmail actually reads – the « sendmail.cf » file.
Now, we’re almost ready, except for one last thing –
8. Type « killall -HUP sendmail » or « kill -HUP « , using the Sendmail PID from « ps -ax ». This will restart Sendmail which forces it to re-read the new config file.
Whew. Well, I’m still alive, and still have my mind. Somewhere.
The system seems to work – I’ve sent mail to a number of people I know, and their servers didn’t choke; sending mail to myself and examining the headers in « /var/spool/mail/ben » with a text editor confirmed that there was nothing horrendously unusual about them. I’ve rebooted the system, and everything still seems OK – now, a day later, I’ve stopped expecting things to go « BOOM ». Still, you never know…
It’s true that Netscape will handle both SMTP and POP services, one user at a time; for most people, this is good enough. On the other hand, if you’re one of those folks (like me) who hates the idea of waiting several minutes for a mail client complete with Web browser, news client, GUI, point-and-click, and lots of confusing options – when all you need is to send some mail – Sendmail may well provide a good answer.
Happy Linuxing to all!
The incredibly confusing and unbelievably complex Sendmail man page
Ditto the /usr/doc/sendmail directory
Double ditto most Net resources
A slightly smaller ditto for RedHat’s « Where’s Everything? » page,
…and one semi-decent resource from RedHat-Europe, the Sendmail-Address-Rewrite mini-HOWTO.