Sendmail implements a general purpose internetwork mail routing facility. This document explain how to install sendmail and run an email server which will send and receive mail using the SMTP protocol.
An IMAP or POP3 server is required to retrieve mail using Eudora or MS Outlook. Sendmail does not offer POP3 or IMAP services.
You should have a basic knowledge of UNIX and DNS.
The server should allow incoming connections to the SMTP service which will be listening on TCP port 25.
The server should have a fully qualified hostname (FQDN) such as mail.example.net.
The hostname should resolve to an A record. It should not be a CNAME.
The MX record for the domain for which you wish to receive mail should point to the hostname of your server.
There should a PTR record for the IP address of your server. Mail from your server may be rejected if there is no reverse DNS.
Download the sendmail source code from the sendmail website.
The sendmail binary is now installed. The next step is to configure sendmail.
The main configuration file for sendmail is the /etc/mail/sendmail.cf file. Starting with version 8.12, sendmail uses the /etc/mail/submit.cf configuration file for mail submission. The .cf files are complex to understand. It is recommended that you create a .mc configuration file and use the M4 (macro processor) to generate the .cf file.
There are some sample .mc configuration files in the cf/cf/ directory of the sendmail source code. Alternatively, you can use one of the sample configuration files available from this website. You should edit the .mc file with a UNIX text editor such as vi.
The following sample configuration files are available for download. If you are using a smarthost, you will find a sample configuration here.
If you already have sendmail installed and configured, you can generate a new sendmail.cf file by using the following command:
The directory for the sendmail m4/cf.m4 file depends on the operating system you are using:
On Solaris, for example, type:
Verify whether you have the following files in /etc/mail
The local-host-names file should contain the domain name for which your mail server should accept mail. It is recommended that you also add localhost to this file. Each entry should be on a new line.
If there is no relay-domains file, create one with the following command:
The aliases file should contain the following entries at least:
In the above example, postmaster is an alias for the root mailbox. The following command will generate the aliases table:
You can create a new access file by typing
The default database map type for Linux, FreeBSD, NetBSD or OpenBSD is hash. Type the following to generate the data bases:
If you are using the smarthost.mc or smarthost-dialup.mc, create a genericstable file and type:
You can now start sendmail.
The sendmail MTA can be started with the following command:
The Mail Submission Agent listens for incoming connections on TCP port 587.
If you are using sendmail 8.12, 8.13 or 8.14, enter the following command to start the Mail Submission Program:
Shutting down sendmail
You can shutdown sendmail by entering the following command:
Viewing the mail queue
You can display the contents of the mail queue with the following command:
Process messages saved in the mail queue
You can process messages saved in the mail queue with the following command:
Verifying whether sendmail is running
You can verify whether sendmail is running by running the following command:
You will see the sendmail banner which shows the version of sendmail you are using. Type quit and press Enter to exit to the shell.
A SMTP test can be done to verify email delivery. Type:
telnet mail.example.net 25
Type the text in bold when you see the following and press Enter
SERVER:220 local ESMTP Sendmail 8.13.5/8.13.5; Wed, 15 Mar 2006 01:51:21 -0800 (PST)
Sendmail uses the mail facility of syslog for logging. The mail log is usually written to /var/log/maillog
Sendmail configuration files
File and directory permissions
The following permissions are generally required for sendmail related files and directories:
-r-xr-sr-x root smmsp /usr/sbin/sendmail
Mail relaying occurs when mail is forwarded from someone else through your mail server. Forwarding mail through a mail server is perfectly natural as long as either the originator of the message or the receiver is a authorized user. If neither the sender nor the recipient of the message is a local user, it is called third-party mail relaying.
Mail servers should be configured not to accept third-party mail relay. If a mail server allows third-party mail relaying from everyone, it is known as an open relay. Such a mail server attracts spammers as it can be used to send large amounts of junk mail under false identity.
If the client computer from which you are connecting from has a static IP address, you can add the following entry, for example, to allowing relaying (send mail):
You should run the makemap command after modifying the access file.
If you are connecting from a dynamic IP address, you should use SMTP AUTH to allow relaying.
Sendmail has been split into two parts, with one part handling mail submission. This allows sendmail to run without being SUID root.
The Mail Submission Program (MSP) uses the /var/spool/clientmqueue directory by default. It will use the /etc/mail/submit.cf configuration file. That configuration file can be generated from the submit.mc using m4.
The MSP will send outgoing mail by passing it to localhost on port 25 using the SMTP protocol. As of sendmail version 8.12.x, you should have sendmail running as a daemon and listening on localhost at least.
Submitting mail from the command line with sendmail
Type the following command where firstname.lastname@example.org is the address of the recipient:
Type in your message, then press Enter and type in a dot and press Enter again.
Piping to sendmail
You can pipe in a message to sendmail with the following command where filename is name of the file containing the message:
/usr/sbin/sendmail email@example.com < filename
Sending file attachments
Sendmail does not send mail attachments. You should encode your file using a MIME encoding utility before piping it to sendmail.
Sendmail X was slated as the next version after sendmail 8. It is not longer being developed. Its successor is MeTA1.
LDA Local Delivery Agent a program that a mail server uses to deliver mail messages to the mailboxes of users. This program is also known as local mailer (e.g. mail, procmail).
MUA Mail User Agent a program that a user uses to process mail messages (e.g. MS Outlook, Eudora, Pine, Mutt).
MTA Mail Transfert Agent a program that a mail server uses to send and receive mail messages using SMTP (e.g. sendmail).
MSA Mail Submission Agent.
MSP Mail Submission Program.
SMTP Simple Mail Transfer Protocol
If you have any comments, send us an email or contact us through our feedback form.
If you have problems sending or receiving emails; or require technical support for sendmail, we can help you.http://www.elandsys.com/resources/sendmail/index.html