Sendmail
E-mail has become the easiest and fastest way of communication in modern times. On the Internet, the majority of servers run the UNIX operating system or its derivatives, such as BSD, Linux, and SunOS. Sendmail is the program most of these systems use to handle e-mail. To use sendmail, you need to install the sendmail and sendmail-cf packages.
Sendmail is able to route or deliver mail between a mail User Agent (UA) and a Message Transfer Agent (MTA). UA is a program you might use to read and send e-mails. MTA is a program that moves mail between hosts using a particular network protocol or language. Sendmail can be easily configured to accommodate new UAs and MTAs, with only minor configuration changes.
When a sender wants to send a message, it issues a request to sendmail. The sendmail program operates in two distinct phases:
- In the first phase, It collects messages and stores them as requests from the senders.
- In the second phase, it delivers the messages to the recipients.
If there are errors during processing in the second phase, sendmail creates and returns a message. This mail provides details of the error that occurred and/or the source of the error. When an error is encountered that can be retried, sendmail places the message in a message queue.When an unrecoverable error is encountered, automatic routing happens and e-mail is sent to the sender.
Configuration Files
The sendmail program uses many configuration files. These files are located in the /etc/mail directory. we will discuss some of these configuration files here:
- Makefile. This file is used when the make command is run. Running
make might cause missing database (.db) files to be created with no
entries. The make command creates the database files. The content of
Makefile is given here:
all: virtusertable.db access.db domaintable.db mailertable.db %.db : % @makemap hash $@ < $< clean: @rm -f *.db *~
- helpfile. This is the text file sendmail displays when you issue a HELP command.
- relay-domains. This file specifies the domains that the computer will relay.
- sendmail.mc. This file contains the m4 macro preprocessor program. The
m4 program is used by sendmail to produce a sendmail configuration file.
When run, this macro program produces the sendmail.cf configuration file:
divert(-1) dnl This is the macro config file used to generate the /etc/sendmail.cf dnl file. If you modify the file you will have to regenerate the dnl /etc/sendmail.cf by running this macro config through the m4 dnl preprocessor: dnl dnl m4 /etc/sendmail.mc > /etc/sendmail.cf dnl dnl You will need to have the sendmail-cf package installed for this to dnl work. include(`/usr/lib/sendmail-cf/m4/cf.m4') VERSIONID(`linux setup for Red Hat Linux')dnl OSTYPE(`linux') define(`confDEF_USER_ID',``8:12'')dnl undefine(`UUCP_RELAY')dnl undefine(`BITNET_RELAY')dnl define(`confAUTO_REBUILD')dnl define(`confTO_CONNECT', `1m')dnl define(`confTRY_NULL_MX_LIST',true)dnl define(`confDONT_PROBE_INTERFACES',true)dnl define(`PROCMAIL_MAILER_PATH',`/usr/bin/procmail')dnl define('ALIAS_FILE','/etc/aliases')dnl define(`STATUS_FILE', `/var/log/sendmail.st')dnl define(`UUCP_MAILER_MAX', `2000000')dnl define(`confUSERDB_SPEC', `/etc/mail/userdb.db')dnl dnl define(`confPRIVACY_FLAGS', `authwarnings,novrfy,noexpn')dnl dnl define(`confTO_QUEUEWARN', `4h')dnl dnl define(`confTO_QUEUERETURN', `5d')dnl dnl define(`confQUEUE_LA', `12')dnl dnl define(`confREFUSE_LA', `18')dnl FEATURE(`smrsh',`/usr/sbin/smrsh')dnl FEATURE(`mailertable',`hash -o /etc/mail/mailertable')dnl FEATURE(`virtusertable',`hash -o /etc/mail/virtusertable')dnl FEATURE(redirect)dnl FEATURE(always_add_domain)dnl FEATURE(use_cw_file)dnl FEATURE(local_procmail)dnl FEATURE(`access_db')dnl FEATURE(`blacklist_recipients')dnl dnl We strongly recommend to comment this one out if you want to protect dnl yourself from spam. However, the laptop and users on computers that do dnl not have 24x7 DNS do need this. FEATURE(`accept_unresolvable_domains')dnl dnl FEATURE(`relay_based_on_MX')dnl MAILER(smtp)dnl MAILER(procmail)dnl
- access. This is the access database. The content of this file is given here:
# Check the /usr/doc/sendmail-8.11.0/README.cf file for a description # of the format of this file. (search for access_db in that file) # The /usr/doc/sendmail-8.11.0/README.cf is part of the sendmail-doc # package. # # by default we allow relaying from localhost... localhost.localdomain RELAY localhost RELAY 127.0.0.1 RELAY
- mailertable. This database will allow you to specify different routes for email. It allows you to specify domain translation or forwarding to a new domain name.
- virtusertable. This database allows you to rewrite and redirect incoming mail. It maps virtual domains and addresses to new addresses.
- aliases. This is the master alias database for the machine. It contains mail aliases. These aliases are used by the system to allow mail sent to one address to be redirected to another recipient. Other uses for the aliases are to allow mail to be piped to a program for additional processing.
In this tutorial:
- Linux Other Network Servers
- Setting the FTP User Account
- Configurations File for FTP Server
- ftpusers
- Anonymous FTP
- Using Proper Password and Group Files
- Anonymous FTP Warnings
- Sendmail
- Sendmail Security
- Domain Name Service
- Domain Name Space
- Services Offered By a DNS Server
- DNS Transactions
- BIND
- BIND Configuration
- Resource Records (RR)
- Start of Authority (SOA)
- nslookup
- BIND Security
- Host Name Spoofing
- Running BIND with Least Privileges
- DNS Security Extensions (DNSEC)
- SAMBA
- SMB Protocol
- Mounting the SMB File System
- SAMBA Security
- Server-Level Security