This information contained in this document is outdated.
It describes how to configure a version of sendmail that is no more the current one.
Moreover, some distributions are now replacing sendmail with Postfix.
For up-to-date information, please refer to the sendmail and/or postfix documentation.
This document explains how to configure sendmail to route all mail generated by /usr/sbin/sendmail or local mail on a host through James on the same host, including mail to local addresses without @host.
All sendmail configuration file locations are for Redhat Linux 7.2, other installations may have different locations.
We take no responsibility for the quality of the information in this document.
You should back-up any configuration files *before* you alter them.
Ok so you want to use James for everything, including delivering mail from localhost to local users.
Well the first step is to stop sendmail from starting up as the SMTP Daemon on port 25, otherwise it will route mail to itself and who knows what will happen then.
Open the sendmail configuration file /etc/sysconfig/sendmail
Change the line:
DAEMON=yes
DAEMON=no
[root@apache root]# /etc/rc.d/init.d/sendmail restart
Ok, so far so good, now you need to tell sendmail to relay everything, regardless of its rules, through James. James will take the roles of "local relay" (destination for all unqualified local addresses), "mail hub" (destination for all qualified local addresses) and "smart relay" (destination for all other mail) for this instance of sendmail, thereby catching everything.
So open /etc/sendmail.cf and..
The developers of sendmail have, wisely, built sendmail in such a way as to prevent, by default, mail being sent by sendmail back to itself, this is done by making a quick check on outgoing mail to see if its destination is our machine. If it is you'll see this message config error: mail loops back to me when you try to send mail.
But we *want* to relay mail to localhost, and because sendmail isn't receiving our mail, James is, we won't be creating a loop. (make sure you've followed step one though).
So open /etc/sendmail.cf again and go to the bottom of the file, start scrolling upwards until you see the declaration of the esmtp mailer it'll look something like this
Mesmtp, P=[IPC], F=mDFMuXa, S=EnvFromSMTP/HdrFromSMTP, R=EnvToSMTP, E=\r\n, L=990, T=DNS/RFC822/SMTP, A=TCP $h
Mesmtp, P=[IPC], F=kmDFMuXa, S=EnvFromSMTP/HdrFromSMTP, R=EnvToSMTP, E=\r\n, L=990, T=DNS/RFC822/SMTP, A=TCP $h
Now you have to make some tests.
Try each of the following, replace names in [] with names of the kind described.
/[root@apache root]# mail -v [real-localusername] [root@apache root]# mail -v [nonexistant-localusername] [root@apache root]# mail -v [real-localusername]@localhost [root@apache root]# mail -v [real-localusername]@[myhostname.mydomainname] [root@apache root]# mail -v [real-username]@[real-remote-account]
SMTP AUTH is a different Kettle of Fish.
The scenario is that you're using SMTP AUTH on James to restrict SMTP relaying to authenticated users, allowing them to connect from any IP address but still not letting James become an open relay for spam, cool.
However you now want to let sendmail relay through James, so you need to tell it how to authenticate.
So open /etc/sendmail.cf again and this time..
username username password localhost
Thats it, good luck and happy mailing :)
Danny Angus