1. Install sendmail
If you have installed the sendmail 8.11 service in Redhat9 by default, you can ignore the installation process. For more information, see the redhat CD documentation.
If the sendmail service is not installed, follow these steps:
// Check whether sendmail is installed
# Rpm-qa | grep sendmail
// Mount the first installation disc of RedHat Linux9 to the optical drive
# Cd/mnt/cdrom
// Enter the RedHat/RPMS directory of the CD
# Cd/mnt/cdrom/RedHat/RPMS
// Install the required software package
# Rpm-ivh sendmail-8.12.8-4.i386.rpm
// Mount the first installation disc of RedHat Linux9 to the optical drive
# Cd/mnt/cdrom
// Enter the RedHat/RPMS directory of the CD
# Cd/mnt/cdrom/RedHat/RPMS
// Install the required software package
# Rpm-ivh sendmail-cf-8.12.8-4.i386.rpm
# Rpm-ivh sendmail-doc-8.12.8-4.i386.rpm
// Pop up the disc
# Cd; eject
2. Check whether dns server's forward/reverse resolution is successful
To make your new email server work properly, you must first resolve the DNS problem. Add the Host Name and IP address of your email server to the DNS and use nslookup to confirm:
# Nslookup-sil mail.supermaster.com
Server: 192.168.0.100
Address: 192.168.0.100 #53
Name: mail.supermaster.com
Address: 192.168.0.100
You also need to try reverse domain name resolution, which plays an important role in preventing mail delay. Most mail servers now use reverse domain name resolution as the mail transmission time.
Part of the authentication. Use your IP address to check whether Reverse Domain name resolution is correct.
# Nslookup-sil 192.168.0.100
Server: 192.168.0.100
Address: 192.168.0.100 #53
100.0.168.192.in-addr. arpa name = mail.supermaster.com.
3. Configure the sendmail service
1) Listen to the smtp port of the Local Machine
Redhat 9 is installed by default to enable the SMTP service to run on the local machine.
You can use netstat-nl to view the ports listened by all background programs. Note this line: 127.0.0.1: 25. This indicates that the sendmail service is already listening to the 25 (SMTP) port on the local machine)
Port:
# Netstat-nl
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
Tcp 0 0 0.0.0.0: 32768 0.0.0.0: * LISTEN
Tcp 0 0 0.0.0.0: 111 0.0.0.0: * LISTEN
Tcp 0 0 0.0.0.0: 22 0.0.0.0: * LISTEN
Tcp 0 0 127.0.0.1: 25 0.0.0.0: * LISTEN
Udp 0 0 0.0.0.0: 32768 0.0.0.0 :*
Udp 0 0 0.0.0.0: 667 0.0.0.0 :*
Udp 0 0 0.0.0.0: 111 0.0.0.0 :*
Active UNIX domain sockets (only servers)
Proto RefCnt Flags Type State I-Node Path
Unix 2 [ACC] stream listening 1119/dev/gpmctl
Unix 2 [ACC] stream listening 1172/tmp/. font-unix/fs7100
However, this only indicates that the e-mail Server only receives emails from your local machine. To solve this problem, you must modify the configuration and tell sendmail to listen to your external NIC address.
2). Solve external smtp port listening
Assume that you have installed an Eni (eth0) on your server and configured your IP address with ifconfig. This address can be different from the address resolved by DNS, but you must ensure that DNS can be correct.
Here we use the same address (recommended ):
# Ifconfig
Eth0 link encap: Ethernet hwaddr 00: 60: 97: de: E9: 99
Inet ADDR: 192.168.0.100 bcast: 192.168.0.100 mask: 255.255.255.0
Up broadcast running Multicast MTU: 1500 Metric: 1
RX packets: 12421 errors: 0 dropped: 0 overruns: 0 frame: 0
TX packets: 5 errors: 0 dropped: 0 overruns: 0 carrier: 0
Collisions: 0 FIG: 100
Interrupt: 10 Base Address: 0xe000
Lo link encap: local loopback
Inet ADDR: 127.0.0.1 mask: 255.0.0.0
Up loopback running MTU: 16436 Metric: 1
RX packets: 6 errors: 0 dropped: 0 overruns: 0 frame: 0
TX packets: 6 errors: 0 dropped: 0 overruns: 0 carrier: 0
Collisions: 0 txqueuelen: 0
The eth0 IP address of this host is 192.168.0.100. Now modify the/etc/mail/sendmail. cf file to configure the listening port of Sendmail:
# SMTP daemon options
O DaemonPortOptions = Port = smtp, Addr = 127.0.0.1, Name = MTA
Change
O DaemonPortOptions = Port = smtp, Addr = 192.168.0.100, Name = MTA
Save and exit after modification, and restart the sendmail service:
# Service sendmail restart
Shutting down sendmail: [OK]
Starting sendmail: [OK]
#
Now you can use netstat-nl to check whether the change has been made. As you can see, the listener port of sendmail is now the IP address of eth0: 192.168.0.100.
# Netstat-nl
Active Internet connections (only servers)
Proto Recv-Q send-Q Local Address Foreign Address State
Tcp 0 0 0.0.0.0: 32768 0.0.0.0: * LISTEN
Tcp 0 0 0.0.0.0: 111 0.0.0.0: * LISTEN
Tcp 0 0 0.0.0.0: 22 0.0.0.0: * LISTEN
Tcp 0 0 192.168.100.134: 25 0.0.0.0: * LISTEN
Udp 0 0 0.0.0.0: 32768 0.0.0.0 :*
Udp 0 0 0.0.0.0: 667 0.0.0.0 :*
Udp 0 0 0.0.0.0: 111 0.0.0.0 :*
Active UNIX domain sockets (only servers)
Proto RefCnt Flags Type State I-Node Path
Unix 2 [ACC] stream listening 1119/dev/gpmctl
Unix 2 [ACC] stream listening 1172/tmp/. font-unix/fs7100
#
//////////////////////////////////////// //////////////////////////////////////// ////////////
3). Set domain names that are allowed to be accepted
Now sendmail can receive external connections. We also need to set the domain name that sendmail allows to receive. This can be found in/etc/mail/local-host-names
Set in the file. Enter the domain name:
# Local-host-names-include all aliases for your machine here.
Supermaster.com
Save and exit and restart sendmail service:/etc/init. d/sendmail restart. in this way, sendmail can receive emails from multiple domains. if you need to add a new domain, you only need to modify this file.
4). client-side settings
The current e-mail server can work properly on the local machine. it can already receive mails from anywhere (allowed domains), but it must be executed on this computer if you want to send and deliver mails. if all your users log on to your server and send emails, you do not need to change any configuration, if you want most or all users to use the e-mail server on a remote host, such as using client tools such as KMail, Outlook Express, and Mozilla mail, you must change the configuration to allow these hosts
Use your e-mail server. You need to add the following line to the/etc/mail/access File, save the line, and run the make access. db command to generate the access. db file.
Supermaster.com RELAY
The modified access file should be like this:
# Check the/usr/share/doc/sendmail-8.12.8-4/README. cf file for
Description
# Of the format of this file. (search for access_db in that file)
# The/usr/share/doc/sendmail-8.12.8-4/README. cf is part of
Sendmail-doc
# Package.
#
# By default we allow relaying from localhost...
Localhost. localdomain RELAY
Localhost RELAY
127.0.0.1 RELAY
Supermaster.com RELAY
Then run:
# Make access. db
#
Make access. the db command adds your new settings to the hash database of sendmail. sendmail uses it to determine which hosts are allowed to pass emails through your e-mail server. in addition, you can set a subnet (for example, 192.168) to limit this domain. however, you should note that this setting is open to the outside world, and a large number of spam mails may be sent to attack your system.
Now you can receive all emails from outside, and allow trusted customers to send emails remotely. Next, what you want to do may be how to receive these emails remotely.
To install IMAP or POP. redhat 9, POP/IMAP is not installed by default. Therefore, you need to install the imap-2000-9 RPM package.
To view the installation status of this package, run the following command: rpm-aq | grep-I imap. If no installation is found, set redhat 9 to the second installation disc.
Put it in the optical drive. Then run the following command:
# Mount/dev/cdrom/mnt/cdrom
Mount: block device/dev/cdrom is write-protected, mounting read-only
(Successful Mount of Read-Only Media)
Mount the disc and run this command to install the package: rpm-Uvh/mnt/cdrom/RedHat/RPMS/imap-2000-9.i386.rpm.
# Rpm-uvh/mnt/CDROM/RedHat/RPMS/imap-2000-9.i386.rpm
Preparing... ######################################## ### [100%]
1: IMAP ####################################### #### [100%]
Run rpm-AQ again | grep-I IMAP
The IMAP package is listed.
# Rpm-AQ | grep-I IMAP
Imap-2000-9
#
5). ipop3 settings
After the correct package is installed, you need to open the POP3 connection port. You need to modify the ipop3 file under/etc/xinetd. d/and change the disable value to yes. This file
It is roughly like this:
# Default: Off
# Description: The POP3 service allows remote users to access their mail
# Using an POP3 client such as Netscape Communicator, mutt,
# Or fetchmail.
Service POP3
{
Socket_type = stream
Wait = No
User = root
Server =/usr/sbin/ipop3d
Log_on_success + = USERID
Log_on_failure + = USERID
Disable = no
}
Next, restart xinetd to make it take effect:
# Service xinetd restart
Stopping xinetd: [OK]
Starting xinetd: [OK]
#
We recommend that you set ipop3 to auto start as follows:
# Redhat-config-services or setup or ntsysv
OK. Now the sendmail configuration is complete. Send a test email to your e-mail server and use the email receiving tool you are familiar with to collect this email. I used Mozilla Mail for testing and succeeded.
4. sendmail Performance Optimization
You may receive such complaints that when the client runs behind the firewall, the connection speed of the pop port will slow down.
The cause of this delay is that your e-mail server initially has an IDENT session to confirm the identity of the client. If the inquiry does not respond, the server will issue a message five seconds later.
A timeout signal. This value can be reduced to 1 second to reduce the IDENT impact. Modify the/etc/mail/sendmail. cf file and change the value of timeout to the value you want.
# Timeouts (bytes of these)
# O Timeout. ident = 5S
Change
O Timeout. ident = 1 s
Now your e-mail server can provide services to your users. Of course, there are more configurations that can be used to improve the server performance, which will not be mentioned in this article.
Linux will provide a stable and efficient platform for your e-mail service. For more information about sendmail, visit www.sendmail.org.
Note: I suggest you disable the fireware service when testing sendmail first.