Setting up a simple email server in linux

Source: Internet
Author: User
Tags imap
Set up a simple mail server in linux-Linux Enterprise Application-Linux server application information. The following is a detailed description. Sendmail is installed by default in rh5, which means sending can be realized. If you want to receive mails in oe, you need to install the corresponding receiving service. This section introduces cyrus-imap to implement email receiving. Cyrus must be installed by yourself.

You can add 2nd and 3rd installation discs of Red Hat Enterprise Linux 5 to the optical drive. After loading the optical drive, find the following RPM package files related to the cyrus-imapd service in the Server directory of the optical drive:

Cyrus-imapd-perl-2.3.7-1.1.el5.i386.rpm
Cyrus-imapd-utils-2.3.7-1.1.el5.i386.rpm
Db4-utils-4.3.29-9.fc6.i386.rpm
Lm_sensors-2.10.0-3.1.i386.rpm
Cyrus-imapd-2.3.7-1.1.el5.i386.rpm
Cyrus-imapd-devel-2.3.7-1.1.el5.i386.rpm

Use rpm? Install the ivh command.

2. Basic configurations of the cyrus-imapd service

The configuration files of the cyrus-imapd service include the following three.

/Etc/sysconfig/cyrus-imapd: the configuration file used to start the cyrus-imapd service.

/Etc/cyrus. conf: it is the main configuration file of the cyrus-imapd service, which contains the setting parameters of each component in the Service (IMAP, POP3, sieve, NNTP, etc.

/Etc/imapd. conf: the configuration file of the IMAP service in the cyrus-imapd service.

By default, these configuration files are basically set up. As long as the cyrus-imapd service is started, POP and IMAP services can be provided at the same time. Run the following command to start services such as cyrus.

Service saslauthd restart
Service cyrus-imapd restart
Service sendmail restart
Service xinetd restart
Chkconfig saslauthd on
Chkconfig cyrus-imapd on
Chkconfig sendmail on

Create a new user in linux, for example, system maintenance user operator

# Useradd operator

# Passwd operator: set the password. Such as test

Do not forget to set/etc/nologin in the passwd file to increase security.

Configure the cyrus Password

# Passwd cyrus

Go to the cyrus management tool

#/Usr/bin/cyradm-u cyrus localhost

"User." Is the prefix before the user mailbox that creates operator.

# Cm user. operator

In the cyradm management command line status, you can use the following command to create other folders, such as the sender, garbage bin, and draft box, for the user lbt in its mail box.

Createmailbox user. lbt. Send
Createmailbox user. lbt. Trash
Createmailbox user. lbt. Drafts

After user. lbt is created, you can use the deletemailbox command to delete the mailbox. Even the Administrator cyrus has no Permission (Permission denied ). To delete it, run the following command to grant the Administrator cyrus full control permission (all ). Then, use deletemailbox to delete the mailbox.

Setacl user. lbt cyrus all
Localhost. localdomain> quit

You can test the user:
Telnet local host 110
The login:
User operator
Pass test
You shoshould see:
+ OK Name is a valid mailbox
+ OK Mailbox locked and ready

This is successful.

Now you need to set up Sendmail to receive the mail and then send the mail to cyrus. Edit the configuration file:/etc/mail/sendmail. mc and add a line at the end of the file:

Dnl MAILER (smtp) dnl
Dnl MAILER (procmail) dnl
Define ('conflocal _ MAILER ', 'cyrus ')
MAILER ('cyrus ')

If you want Sendmail to receive emails from other addresses except the local machine

DAEMON_OPTIONS ('port = smtp, Addr = 127.0.0.1, Name = MTA ') dnl

Changed:
Dnl DAEMON_OPTIONS ('port = smtp, Addr = 0.0.0.0, Name = MTA ') dnl

Then, execute:
# M4/etc/mail/sendmail. mc>/etc/mail/sendmail. cf

You need to restart Sendmail:
Service sendmail restart

In this case, you can set up an email address in oe and use the operator password to collect emails with test. You can compile scripts to view the system status and forward the emails sent to the root user to operator, in the crontab, set the message to be sent at every day, so that you can view the system status through oe every day at work, without a login server to view the system status. Convenience.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.