Does your ISP prohibit email message attachments larger than 10 MB or impose other restrictions that you find cumbersome? Your Linux system can provide an email server that isn’t subject to such arbitrary restrictions.
Mail is one of the services that ISPs are least likely to tolerate,
owing to the ongoing war against spam. Often, ISPs block the ports
used by sendmail
so customers cannot operate
unauthorized mail servers. Check with your ISP before taking the time
to set up a mail server.
The
sendmail
package is a powerful Mail Transfer
Agent (MTA), which transfers email from one system to another.
Don’t confuse sendmail
and other MTAs with mail clients (sometimes
called mail user agents), such as pine
or mutt
, which merely
allow you to send and receive email. Mail clients communicate with
MTAs, not with one another.
Depending on the options you selected during system installation,
sendmail
may already reside on your system. To
check whether it’s installed, issue the command:
rpm -q sendmail
If sendmail
is installed, the command reports
its version number; otherwise, the command reports that
sendmail
is not installed.
To
install sendmail
, use GnoRPM to install the
sendmail
, sendmail-cf
, and
m4
packages.
sendmail
starts
automatically when you install it; to check the status of
sendmail
, issue the following command:
service sendmail status
The command should identify the process ID of
sendmail
. If sendmail
is
not running, you can start it by issuing the following command:
service sendmail start
You can stop sendmail
by issuing the command:
service sendmail stop
You probably won’t need to change
sendmail
’s hugely complex configuration
file, /etc/sendmail.cf
. However, if you do, you
can restart sendmail
by issuing the command:
service sendmail restart
If you want sendmail
to start automatically when your system boots, issue the
command:
chkconfig --level 345 sendmail on
You can also use Linuxconfto
configure sendmail
to start automatically.
You should now be able to send and receive email. Test your server by sending yourself an email message:
[root@localhost /etc]#[email protected]
Subject:test message
This is a test.
.
Cc: [root@localhost /etc]#
Once you know that the server is working, you can configure your favorite mail client to specify your own system as your mail server. For example, if you’re using Netscape Navigator, select Edit → Preferences → Mail Servers. Make a note of the existing mail server settings, just in case something goes wrong. Then, change the incoming and outgoing mail server options to specify your Linux machine.
The sendmail
service is capable of sending and
receiving email. If you plan to receive email, your system should be
continuously connected to the Internet. This means that you’ll
need a static IP address and a registered domain name. And, as
explained earlier, you should also have an understanding ISP. Contact
your ISP prior to setting up any web or mail server of your own.
By default, sendmail
accepts connections only
from the local host. To configure sendmail
to
accept connections from other hosts, you must edit the
/etc/mail/sendmail.mc
file. Insert a hash mark
(#) in column one of the line containing the term
DAEMON_OPTIONS
and the line containing
FEATURE(accept_unresolvable_domains)
and then
save the file. Then, issue the following commands:
m4 /etc/mail/sendmail.mc > /etc/sendmail.cf
service sendmail restart