Sandmail in the system conflicts with postfix.
Step 1 uninstall sandmail and yum remove sandmail
Step 2: Install postfix, dovecot, cyrus-sasl, and install yum directly.
Yum-y install devecot
Yum-y install postfix
Yum-y install cyrus-sasl
3. Modify the postfix configuration file
[Root @ ser ~] # Vim/etc/postfix/main. cf
Myhostname = mail.eimam.com
Mydomain = eimam.com
Myorigin = eimam.com
Inet_interfaces = all
Mynetworks = 192.168.1.0/240
Relay_domains = yjw.com, $ mydomain
Mydestination = $ myhostname, localhost. $ mydomain, localhost, $ mydomain, mail. $ mydomain, www. $ mydomain, ftp. $ mydomain
Restart the postfix Service
[Root @ ser ~] # Service postfix restart
Shutting down postfix: [OK]
Starting postfix: [OK]
[Root @ ser ~] # Chkconfig postfix on
[Root @ ser ~] # Chkconfig dovecot on
Modify the dovecot configuration file
Vim/etc/dovecot. conf
Protocols = imap imaps pop3 pop3s, remove the pop3s here .)
Listen = *
Open Port 25,110,143 in iptables
[Root @ ser ~] # Vim/etc/sysconfig/iptables
-A RH-Firewall-1-INPUT-m state -- state NEW-m tcp-p tcp -- dport 110-j ACCEPT
-A RH-Firewall-1-INPUT-m state -- state NEW-m tcp-p tcp -- dport 25-j ACCEPT
-A RH-Firewall-1-INPUT-m state -- state NEW-m tcp-p tcp -- dport 143-j ACCEPT
Restart iptables
[Root @ ser ~] # Service iptables restart
Flushing firewall rules: [OK]
Setting chains to policy ACCEPT: filter [OK]
Unloading iptables modules: [OK
Applying iptables firewall rules: [OK]
Loading additional iptables modules: ip_conntrack_netbios_n [OK] ntrack_ftp
[Root @ ser ~] # Chkconfig saslauthd on
Modify/etc/sysconfig/saslauthd
[Root @ ser ~] # Vim/etc/sysconfig/saslauthd
# Directory in which to place saslauthd's listening socket, pid file, and so
# On. This directory must already exist.
SOCKETDIR =/var/run/saslauthd
# Mechanic to use when checking passwords. Run "saslauthd-v" to get a list
# Of which mechanic your installation was compiled with the ablity to use.
MECH = shadow
# Additional flags to pass to saslauthd on the command line. See saslauthd (8)
# For the list of accepted flags.
FLAGS =
Modify/usr/lib/sasl2/smtpd. conf
[Root @ ser ~] # Vim/usr/lib64/sasl2/smtpd. conf
Pwcheck_method: saslauthd
Test saslauthd
[Root @ ser ~] # Service saslauthd restart
[Root @ ser ~] # Testsaslautd-u yjw-p '000000'
0: OK "Success ."
Add the following content to the postfix configuration file to support SMTP authentication.
[Root @ ser ~] # Vim/etc/postfix/main. cf
Message_size_limit = 1073741824 # The Mail size is 10 MB.
Default_process_limit = 50
Default_destination_concurrency_limit = 20
Smtpd_sasl_auth_enable = yes
Smtpd_sasl_local_domain = $ myhostname
Smtpd_sasl_application_name = smtpd
Broken_sasl_auth_clients = yes
Smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
Smtpd_client_restrictions = permit_sasl_authenticated
Smtpd_sasl_security_options = noanonymous
Test port 25
[Root @ ser ~] # Telnet mail.yj1_com 25
Trying 192.168.1.2...
Connected to mail.yjw.com (192.168.1.2 ).
Escape character is '^]'.
220 mail.yjw.com ESMTP Postfix
EHLO 163.com
250-mail.yjw.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-AUTH LOGIN PLAIN
250-AUTH = LOGIN PLAIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
Quit
221 2.0.0 Bye
Connection closed by foreign host.
[Root @ ser ~] #
Now you can test to send an email to root, echo "this is a test mail! "| Mail-s mailname root
Enter mail to check whether the operation is successful. You can also send emails to your QQ mailbox and change the root account to the QQ mailbox address.
4. Install openwebmail
[Root @ ser ~] # Vim/etc/yum. repos. d/openwebmail. repo
[Openwebmail]
# Thomas Chung
#2008.05.29
Name = Openwebmail for Fedora or Enterprise Linux
Base url = http://openwebmail.org/openwebmail/download/redhat/rpm/release/
Enabled = 1
Gpgcheck = 1
Gpgkey = http://openwebmail.org/openwebmail/download/redhat/rpm/release/RPM-GPG-KEY-openwebmail
# Metadata_expire = 0
If this installation fails, first install perl-Text-Iconv-1.4-1.2.el4.rf.i386.rpm
: Http://rpm.pbone.net/index.php3? Stat = 26 & dist = 42 & size = 19383 & name = perl-Text-Iconv-1.4-1.2.el4.rf.i386.rpm
[Root @ ser ~] # Yum-y install openwebmail
[Root @ ser ~] # Cd/var/www/cgi-bin/openwebmail/
[Root @ ser openwebmail] #./openwebmail-tool.pl -- init # When Y/N appears, press N.
Modify some configuration files of openwebmail
[Root @ ser etc] # vim dbm. conf
Dbm_ext. db
Dbmopen_ext. db
Dbmopen_haslock no
[Root @ ser etc] # cd defaults/
[Root @ ser defaults] # vim dbm. conf
Dbm_ext. db
Dbmopen_ext. db
Dbmopen_haslock yes
Smtpserver 192.168.1.2
[Root @ ser defaults] # vim openwebmail. conf
Domainnames yjw.com
Smtpserver 192.168.1.2
Authpop3_server 192.168.1.2
Initialize openwebmail again
[Root @ ser defaults] # cd http://www.cnblogs.com/openwebmail-tool.pl -- init
When Y/N appears, Press Y.
Just unify the Postfix + Dovecot + Openwebmail formats.
1. Configure main. cf with postfix
Mail_spool_directory =/var/spool/mail
2. Configure Dovecot. conf in Dovecot
Mail_location = mbox :~ /Mail: INBOX =/var/spool/mail/% u
3. Openwebmail. conf
Mailspooldir/var/spool/mail
Modify apache configuration
[Root @ ser ~] # Vim/etc/httpd/conf/httpd. conf
ServerAdmin
Root@yjw.com
ServerName mail.yjw.com: 80
AddHandler cgi-script. cgi. pl
5. log on to openwebmail
Enter mail.yjw.com/cgi-bin/openwebmail/openwebmail.pl in IE. Is this address very long? So let's take a short look.
Add the following content to the httpd configuration file:
ScriptAlias/mail/var/www/cgi-bin/openwebmail. pl
In this way, enter
Mail.yj#com/mail
If the following problem occurs:
Couldn't create File/var/log/openwebmail. log! (Permission denied)
Find a solution on the Internet:
Touch/var/log/openwebmail. log
Chcon-u system_u/var/log/openwebmail. log
Chcon-t httpd_sys_script_rw_t/var/log/openwebmail. log
Chcon-t httpd_unconfined_script_exec_t/var/www/cgi-bin/openwebmail *
Then refresh the page and a pretty interface will appear.