Building full-featured mail system

xiaoxiao2021-03-06  111

This system can be called full-featured: almost all functions supported by a popular mail system, including send attachments, POP3 or IMAP recipients, user folders management, address book, modify password, etc. If you are willing, you can also achieve functionality of calendar, notepad. All this can be implemented through a web mode, namely webmail. [Directory] one. Basic principle of the mail system. The network environment required is required. Install the operating system four. Set Sendmail. Install IMAP 6. Install Web Mail Support - Apache, MySQL, and PHP Seven. Install Web Mail Eight. Install the address book module nine. Install the modified password module one. The basic principle of the mail system first let us know the basic principles of the email system. Only one brief introduction here is detailed, refer to the relevant books. Under normal circumstances, we break the email program into user agents, transfer agents and delivery agents. The user agent transmits the user's letters to the transfer agent (such as Outlook Express, Foxmail et al.). The mail transfer agent is responsible for sending emails to the target host (such as Sendmail). The delivery agent receives letters from the letters transfer agent to the end user's mailbox (such as procmail). Let's simulate an email from the process you receive. Users use Outlook Express to request send email services to Sendmail (Transport Agents) to send mail to Sendmail. Sendmail sends mail to the mail receiving server according to the address of the email, and the mail receives the mail cache (this is also the work of Sendmail). The user who receives the mail uses Outlook Express to send a letter to the mail receiving server, and the mail receiving server sends a message to the user (this is the work of the IMAP or POP service). At this point, an email arrives at the recipient's machine from the sender's machine. The mail server we have to build, with a superior performance system for the operating system. As sentmail as a mail transmission service, IMAP makes a receiving service to form the basic framework of the mail system. As a web client for Horde IMP as a message. The remaining is Horde IMP support software: store user data with mysql to take Apache PHP as a web server. We also use other modules to expand the functionality of the system: the address book module and the modified password module.

We will install the following software: 1. Redhat Linux7.3 role: Operating system download address: http://freesoft.online.sh.cn:8888/mirrors/redhat/7.3/2. Sendmail-8.11.6 Role: Mail Transfer and Receive Download Address: (Redhat Linux7.3 Between) 3. IMAP effect: IMAP and POP3 server download address: ftp://ftp.cac.washington.edu/imap/imap-2001a.tar.z 4. Apache-1.3.24 Role: Web Server Download Address: http://freesoft.online.sh.cn: 8888 / mirrors / ftp.apache.org / httpd / apache_1.3.24.tar.gz 5. PHP-4.2.1 Role: CGI scripting language Download address: http://www.php.net/do_download.php? Download_File = PHP-4.2.1.tar.gz 6. PEAR-4.1.0 role: PHP function expansion module Download address: ftp://ftp.horde.org/pub/horde/tarballs/pear-4.1.0.tar.gz 7. MySQL effect: database, store mail user data and address book download address: http://freesoft.online.sh.cn: 8888 / mirrors / data / mysql / mysql-3.23.49.tar.gz 8. Horde-2.1 role: IMP support module download address: ftp://ftp.horde.org/pub/horde/tarballs/horte-2.1.tar.gz patch: ftp://ftp.horde.org/pub/horde /tarballs/patch-horte-2.0-2.1.gz 9. IMP-3.1 Role: Web Mail's core program Download address: ftp://ftp.horde.org/pub/imp/tarballs/imp-3.1.tar.gz patch: ftp: //ftp.horde.org/pub/ IMP / TARBALLS / PATCH-IMP-3.0-3.1.gz 10. Turba-1.1 Role: Provide a module for communication files Download address: ftp: //ftp.horde.org/pub/turba/tarballs/turba-1.1.tar.gz patch: ftp: //ftp.horde.org/pub /Turba/tarballs/patch-turba-1.0-1.1.gz 11. Poppassd-1.8.2 Role: Modify the password service, and provide a web way to the Passwd for IMP to modify the user password. Download address: http://echelon.pl/pubs/poppassd-1.8.2.tar.gz 12. Passwd for IMP: Provides a module download address for modifying password features: https: //mail.ph.utexas.edu/test2/passwd.tgz II. Needable Network Environment This article assumes that users want to set up an email server in the park network to provide mail services for the unit users.

The server has a legitimate IP address 202.99.11.200 and a legitimate domain mail.example.com, and the MX record of Example.com's DNS points to mail.example.com. Note: In order to meet the demand for domain name, Example.com's DNS domain data files should contain the following: IN MX 10 Mail Mail in A 202.99.11.200. Installing the operating system Redhat Linux7.3 Redhat Linux7.3 installation in many data. Here is only a partition problem, as a mail system, the main disk space is used to store the user's mail. We installed most software in / usr, while users receive messages stored in / var, user processing (delete, mobile, etc.) stored in / home. Everyone should determine the reasonable partitioning program according to their own situation. four. After installing Sendmail, the redhat linux7.3 is installed, and Sendmail is installed. If not, you can install it from the RPM package from the first installation disc of Redhat Linux7.3. Next we only make some simple settings for Sendmail. Sendmail's profile is mainly /etc/sendmail.cf. Here, we need to modify two places: Original content: CWLocalHost Modified to: cwexample.com Role: Define the domain of the mail exchange: o deamonportOptions = port = SMTP, addr = 127.0.0.1 ... At 260 lines) modified to: (annotated this line): The role of this line is to use SMTP services from this machine as a mail system, which is obviously not possible. After the modification is complete, type: # / etc / rc.d / init.d / sendmail restart restart Sendmail to make changes to the modification. Fives. Installing IMAP IMAP provides both IMAP and POP3 services, and their role is to provide users who charge letters, here we only use IMAP services. We assume that all software to be installed has been downloaded to / TMP. The commands involved in this article are performed as root. 1. Unzip, installation: # CD / TMP # TAR ZXVF IMAP-2001A.TAR.Z # CD IMAP-2001A # make SLX 2. Copy the generated executable to / usr / sbin #cp iMapd / iMapd / usr / sbin 3. Under /ECT/Xinetd.d New File IMAP #vi /etc/xinetd.d/imap content: # imap server at port 143 service imap {disable = no socket_type = stream wait = no user = root server = / usr / Sbin / iMapd} 4. Restart Xinetd /ECT/rc.d/init.d/xinetd Restart 5. Test IMAP Services No #telnet localhost 143 If you see your welcome information, the IMAP server is installed successfully. Note, do not delete the IMAP installation file, we will use it later.

six. Install Web Mail Support - Apache, MySQL, and PHP, we have to build web servers and database support for IMP. 1. Install MySQL Web Mail IMP stores user settings and address records in the database, and we use common Mysql. 1.1 Unzip, configure compilation, installation: # CD / TMP # TAR ZXVF mysql-3.23.47.tar.gz # cd mysql-3.23.47 # ./configure --prefix = / usr / local / mysql # make # make install After completion, MySQL is installed to / usr / local / mysql. 1.2 Creating User MySQL and Group MySQL #Groupadd MySQL # uSQL 1.3 Start Mysql: #CD / USR / local / mysql / bin # ./mysql_install_db (Install MySQL Basic Database) # ./safe_mysqld -uroot & (Start MySQL and transfer to the background) 1.4 Test mysql # ./mysql If you can connect the database, the mysql installation is complete. Please pay attention to modify the ROOT password of MySQL to increase security. Please refer to the relevant information for other operations. 2. Installing Apache, PHP and Pear Horde and IMP are written in PHP. To make it run, you must provide Web services and PHP scripting language support, and PEAR is a PHP function extension module, although PEAR is installed when PHP is installed. But Horde requires a newer version.

2. Decompression: # cd / tmp # tar zxvf apache-1.3.24.tar.gz # tar zxvf php-4.2.1.tar.gz 2.2 Precommination Apache # CD Apache-1.3.24 # ./configure 2.3 configuration, compile , Install php, according to the needs of IMP, plus the corresponding parameters, can refer to the relevant information to modify # CD ../php-4.2.1 # ./configure --with-mysql = / usr / local / mysql --with -apache = .. / apache-1.3.24 --with-imap = .. / imap2001a --with-getText --with-XML # make # make install 2.4 configuration, compile, install apache # cd ../apache- 1.3.24 # ./configure - prefix = / usr / local / apache --activate-module = src / modules / php4 / libphp4.a 2.5 copy PHP configuration file to / usr / local / lib # cd ../php -4.2.1 # cp php.ini-recommented / usr / local / lib 2.6 replace the old version with new version of PEAR # cd / usr / local / lib # mv php php.bak # CP / TMP / PEAR-4.1.0 .tar.gz. # TAR zxvf pear-4.1.0.tar.gz # mv pear-4.1.0 php # chown root.root -r php 2.7 For PHP modification Apaceh configuration file / usr / local / apache / conf / http .conf found two lines: # addtype application / x-httpd-php .php # addtype application / x-httpd-php-source .phps Remove the comment, the role of this two lines is the suffix of the PHP document. Also modify the default home type, find: DirectoryIndex index.htm change: DirectoryIndex index.htm index.php default.htm default.php 2.8 Start Apache # / usr / local / apache / bin / apachectl start 2.9 Test Apache and PHP Delete / usr / local / apache / htdocs / all file # cd / usr / local / apache / htdocs / # rm -rf * New file Test.php, the content is: find a machine to access the Internet, in the browser address Enter: http://mail.example.com/test.php, if you can see the information about PHP, the Apache and PHP installation are successful. Seven. Installing Web Mail IMP is http://horde.org/ Published. It is a mail client program for a functionally perfect web interface written in PHP. It connects the mail server with the IMAP or POP3 protocol to complete the various functions of the mail system. It is worth mentioning that it supports multiple language interfaces, including Simplified Chinese. Horde is http://horde.org/ Published Horde Application Framework (Application Framework), http: //horde.org/ All programs released must be based on Horde, IMP is no exception. We first install Horde.

1. Install Horde 1.1 Copy Horde Compression Pack to the root directory of the web server and extract # cd / usr / local / apache / htdocs # cp /tmp/horte-2.1.tar.gz. # Tar zxvf horde-2.1.tar.gz # mv Horde-2.1 horde application patch: # cd horde # cp /tmp/patch-horde-2.0-2.1.gz. # Gunzip Patch-horde-2.0-2.1.gz # patch -p1 1.2 For Horde and IMP Preparation Database Determine MySQL Run, we will establish the database required to Horde and IMP in MySQL. Use a SQL script file in Horde to automate this job, before performing, modify the password of the database user. # CD horde / scripts / db # vi mysql_create.sql found: Replace INTO USER (Host, User, Password) Values ​​('localhost', 'horde', - important: change this password! password ('horde') // User password); change the contents of the bevel part into its own password, here it is assumed to be changed to "XXX". Create a database: # / usr / local / mysql / bin / mysql EXIT 1.3 Setting Horde Horde and IMP settings in their configuration file.

Copy configuration file: # cd horde / config # for foo in * .dist; do cp -v $ foo `basename $ foo .dist`; DONE Edit the following file: 1.3.1 Horde setting file horde.php // Take IMAP As a login authentication $ conf ['auth'] = 'IMAP'; $ conf ['auth'] ['params'] = array (); $ conf ['auth'] ['params'] [ 'DSN'] = '{localhost / IMAP: 143} Inbox'; // Using MySQL Storage User Information $ conf ['prefs'] [' Driver '] =' SQL '; $ conf [' prefs'] ['params '] = array (); $ conf [' prefs'] ['params'] [' phpoType '] =' mysql '; $ conf [' prefs'] ['params'] [' HostSpec '] =' localhost ' ; // Database Server $ Conf ['prefs'] [' params'] ['username'] = 'horde'; // Database User $ conf ['prefs'] [' params'] ['password'] = ' XXX '; // Establishing a password set when setting up a database $ conf [' prefs '] [' params '] [' Database '] =' horde '; // Database $ conf [' prefs '] [' params '] [' Table '] =' horde_prefs'; // Table // Send Mail $ conf ['MAILER'] ['Type'] = 'Sendmail'; 1.3.2 Language Settings File Lang.php $ NLS ['Defaults'] ['Language'] = 'zh_cn'; // The default language is set to Simplified Chinese (End)

转载请注明原文地址:https://www.9cbs.com/read-125509.html

New Post(0)