Sendmail Service Configuration — Basics Guide

1. Sendmail Service Packages
sendmail-8.13.8-2.el5.i386.rpm: The main program package for the Sendmail service; this package must be installed on the server side. 
sendmail-cf-8.13.8-2.el5.i386.rpm: Sendmail macro file package 
sendmail-devel-8.13.8-2.el5.i386.rpm: Sendmail server development tools package 
sendmail-doc-8.13.8-2.el5.i386.rpm: Sendmail server documentation 
m4-1.4.5-3.el5.1.i386.rpm: Macro processing filter package 
dovecot-1.0-1.2.rc15.el5.i386.rpm: Mail receiving package; pay attention to the installation order.

2. Sendmail Related Configuration Files
sendmail.cf: The core Sendmail configuration file, located at /etc/mail/sendmail/sendmail.cf
sendmail.mc: Sendmail provides a template file. By editing this file and then using the m4 tool to import the results into sendmail.cf, you can configure the core Sendmail configuration file, reducing configuration complexity. Located at /etc/mail/sendmail.mc
local-host-name: Defines the domain names and host aliases for the sending and receiving mail server, located at /etc/mail/local-host-name
access.db: Used to configure which hosts the Sendmail server will relay mail for, located at /etc/mail/access.db
aliases.db: Used to define mailbox aliases, located at /etc/mail/aliases.db
virtusertable.db: Used to configure virtual accounts, located at /etc/mail/virtusertable.db

3. Mail Functional Components
MUA: Mail User Agent
MTA: Mail Transfer Agent
MDA: Mail Delivery Agent

4. Standard Sendmail Server Setup Process: (1) Configure the sendmail.mc file (2) Use the m4 tool to import the sendmail.mc file into the sendmail.cf file (3) Configure the local-host-names file (4) Create user accounts

(5) Restart the service to apply the configuration

5. Specific Steps:
#yum install sendmail-*   // Install the corresponding Sendmail packages. The purpose of each package was introduced earlier.
#yum install m4*      // Install the macro processing filter package, a tool for quickly configuring Sendmail.
#vi /etc/mail/sendmail.mc // Edit the configuration file
Change the listening range from 127.0.0.1 to 0.0.0.0
Change the local domain to the one used by your mail server: LOCAL_DOMAIN(`example.com')dnl
#cd /etc/mail   // Enter the /etc/mail directory
#make   // Use the m4 command to import sendmail.mc into the main sendmail.cf configuration file.
This command is equivalent to: m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
#vi /etc/mail/local-host-names   // Edit the local-host-names file to add the domain name and hostname. Add your server’s domain name, or the fully qualified hostname, such as station133.exameple.com example.com
==============
At this point, your Sendmail service is ready, although the POP service is not yet enabled.

6. Install the POP Service
#yum install dovecot-*   // This installs your POP server. The IMAP protocol is also included in this package.

7. Start the Corresponding Sendmail Services
#service sendmail restart
#service dovecot restart
#chkconfig senmdial on
#chkconfig dovecot on

8. Testing and Verification
#netstat -nltp | grep "25"
#netstat -nltp | grep "110"
#telnet 192.168.76.133 25
ehlo station133.example.com
#telnet 192.168.76.133 110
If there are no errors, it means your Sendmail server has been set up successfully.

9. Create a new user, mailuser, and then test sending and receiving emails from the client. Since DNS is not used here, email can only be sent within the example.com domain!

Leave a Comment

Your email address will not be published.