Sendmail server, sendmail server configuration
Email is the most commonly used on the Internet, and many enterprise users often use free email systems. Today, I will introduce you to Sendmail, a mail server software running in Red Hat Linux 9.0. as a free mail server software, Sendmail has been widely used in a variety of servers. It has certain characteristics in terms of stability, portability, and bug-free, you can also search for a large amount of useful materials on the Internet.
1. Install Sendmail
When Red Hat Linux 9.0 is fully installed, Sendmail is automatically built in with the version 8.12.8-4. If you are not sure whether sendmail is installed in Linux, run the following command:
- [Root @ ahpeng root] rpm-qa grep sendmail
If you are sure that the application is not installed, choose "Main Menu"> "system settings"> "add or delete application" in the graphic interface ", select the mail server option in the open "software package management" window, click "Update", and follow the prompts to install it.
Another way is to insert the Linux 1st installation CD directly, select the sendmail-8.12.8-4.i386.rpm installation package under the/RedHat/RPMS directory, then run [root @ ahpeng RPMS] # rpm-ivh sendmail-8.12.8-4.i386.rpm to start installation, and then use this method to install sendmail-cf.8.12.8-4.i386.rpm and sendmail-doc in the same directory of the 3rd installation discs. 8.12.8-4. i386.rpm.
Ii. Start the Sendmail service system
I suggest using the Sendmail command with parameters to control the running of the mail server:
- [Root @ ahpeng root] # sendmail-bd-q12h
-B: Set the Sendmail service to run on the background.
-D: Specify Sendmail to run in Daemon mode.
-Q: When Sendmail fails to send emails, the emails are saved in the queue and the storage time is specified. The above 12 hours indicates that the data is retained for 12 hours.
To check whether the Sendmail server is running properly, run the following command:
- [Root @ ahpeng root] #/etc/rc. d/init. d/sendmail status
3. configure Sendmail
Sendmail. the configuration Syntax of cf is relatively difficult. Generally, m4 macro processing programs are used to generate the required sendmail. cf files (using m4 compilation tools is generally not prone to errors, and some macros with security vulnerabilities can be prevented from causing damage to the server ). The configuration file is located in/etc/mail/sendmail. cf. a template file is also required during the creation process. Linux has a template file, which is located in/etc/mail/sendmail. mc. therefore, you can directly modify sendmail. mc template to customize sendmail. the purpose of the cf file, instead of having to stick to the difficult-to-understand configuration commands. The configuration steps are as follows:
Step 1: use the template file sendmail. mc to generate the sendmail. cf configuration file, export it to the/etc/mail/directory, and run the command line m4.
- /Etc/mail/sendmail. mc>/etc/mail/sendmail. cf
Step 2: Reuse
- [Root @ ahpeng root]/etc/rc. d/init. d/sendmail restart
Run the command line to restart sendmail.
At this point, the mail service system has been configured and is working properly. The next step is to create a specific account.
4. Create a new email account
This step is relatively simple. You only need to add a user in Linux. Choose "Main Menu"> "system settings"> "users" and "group". Then, open the "Red Hat User Manager" dialog box and click "Add User, enter the user name and password in the "Create new user" window that appears.
Create a mail account. The command line is as follows:
- [Root @ ahpeng root] # adduser mailA-p Pass
Indicates that a mailA account is created and the password is Pass.
5. Limit the mailbox capacity of a single user
If the user's mail capacity is not limited, the server's hard disk is overwhelmed. This can be achieved through the "mail quota" function: Because the temporary storage space for email is located in the/var/spool/mail directory, therefore, you only need to set the maximum space that each email account can use in this directory through the disk quota.
6. set multiple email addresses for a single user
The alias (alias) can be used to solve this problem. Aliases are one of the most important functions of sendmail. It is defined in the aliases text file. The location of the aliases file is specified by sendmail. cf, which is generally located in the/etc directory. For example, the mailA user we created earlier needs to have 2 email addresses: mailA@yourdomain.com and mailB@yourdomain.com, which can be set like this:
First, add an account mailC and use the Linux text editor to open/etc/aliases. Add the command lines dearpeter: mailC and truepeter: mailC to the account; then run the newaliases command in the Command window to require Sendmail to re-read the/etc/aliases file. If it is correct, a response message is displayed, indicating that the configuration is successful. In this way, two addresses can be used to send emails to mailC, while mailC can receive all emails sent to the preceding two addresses with only one account.
After the preceding steps, you can use Outlook Express to send emails normally. However, you cannot use Outlook Express to receive emails from the server, because sendmail does not have the POP3 function by default, we have to install and enable it on our own.
1. Install the POP3 (IMAP) server.
Step 1: run the following command to check whether the system is installed:
- [Root @ ahpeng root] # rpm-qa imap
Imap-2001a-18
Step 2: insert 2nd installation discs and use the following command line to start installation:
- [Root @ ahpeng root] # cd/mnt/cdrom/RedHat/RPMS
- [Root @ ahpeng root] # rpm-ivh imap-2001a-18.i386.rpm
2. Enable the POP3 (IMAP) service.
POP3 Service: Modify/etc/xinetd first. in the d/ipop3 file, change disable = yes to disable = no and save it. Then restart the xinetd program to read the modified configuration file and make it take effect.
- [Root @ ahpeng root] #/etc/rc. d/init. d/xinetd reload
The procedure for starting the IMAP service is the same as that for POP3, except that the IMAP configuration file is/etc/xinetd. d/imap.