分类: 服务器与存储
2014-05-04 16:22:19
步骤一:关闭sendmail服务
service sendmail stop
chkconfig -level 35 sendmail off
步骤二:yum安装postfix软件
yum -y install postfix
步骤二:筛选Postfix的配置文件
cd /etc/postfix/
postconf -n > main2.cf
mv main.cf main.cf.bak
mv main2.cf main.cf
cat main.cf
步骤三:Postfix的启动控制
postfix
start/stop
/etc/init.d/postfix start.stop.restart
步骤五:编辑main.cf文件,调整Postfix的基本运行参数
vi /etc/postfix/main.cf
inet_interfaces = 192.168.10.142, 127.0.0.1
myhostname = mail.lele.com
mydomain = lele.com
myorigin = $mydomain
mydestination = $mydomain, $myhostname
home_mailbox = Maildir/
步骤二:添加邮件用户的账号
groupadd mailusers
useradd -g mailusers -s /sbin/nologin xiaoqi
useradd -g mailusers -s /sbin/nologin lisi
echo 123| passwd --stdin xiaoqi
echo 123| passwd --stdin lisi
步骤三:SMTP发送邮件测试
telnet localhost 25
helo localhost
mail from:xiaoqi@benet.com
rcpt to:lisi@benet.com
data
subject:A test file
Hello lisi
this is a test mail
.
quit
测试
##################基于Postfix简单电子邮件系统搭建完毕##################
接下来我们来构建Dovecot服务器
步骤一:使用yum安装dovecot服务器
yum -y install dovecot
步骤二:配置Dovecot的运行参数
vi /etc/dovecot-conf
ssl_disable = yes
protocols = pop3 imap
disable_plaintext_auth = no
mail_location = maildir:~/Maildir
vi /etc/pam.d/dovecot(创建PAM认证文件)
auth required pam_nologin.so
auth include system-auth
account include system-auth
session include system-auth
步骤三:启动Dovecot服务,并验证其监听的TCP端口(110、143)
步骤四:POP3接受邮件测试
步骤一:安装程序包、中文语言包
tar jxvf squirrelmail-1.4.19.tar.bz2 -C /usr/local/apache/htdocs/
cd /usr/local/apache/htdocs/
mv squirrelmail-1.4.19 webmail
cd webmail
tar jxvf zh_CN-1.4.13-20071220.tar.bz2 -c webmail
步骤二:创建及调整数据目录、附件目录
mkdir -p attach data
chown -R daemon:daemon attach/ data
chmod 730 attach/
步骤三:建立config.php配置文件
cp config/config_default.php config/config.php
vi config/config.php
$squirrelmail_default_language = 'zh_CN';
$default_charset = 'zh_CN.UTF-8';
$domain = 'lele.com';
$smtpServerAddress = 'localhost';
$smtpPort = 25;
$imap_server_type = 'dovecot';
$imapPort = 143;
$data_dir = '/usr/local/apache/htdocs/webmail/data/';
$attachment_dir = '/usr/local/apache/htdocs/webmail/attach/';
步骤四:启动httpd服务,并在浏览器中登陆SquirrelMail系统
/usr/local/apache/bin/apachectl
restart
步骤五:测试
################设置SMTP的用户认证
步骤一:设置Cyrus SASL函数库,并启动saslauthd服务
cp /usr/lib/sasl2/Sendmail.conf /usr/lib/sasl2/smtpd.conf
vi /usr/lib/sasl2/smtpd.conf
pwcheck_method:saslauthd
service saslauthd start
chkconfig --level 35 saslauthd on
步骤二:修改main.cf配置文件,添加SMTP认证相关的配置参数,并重新加载配置
vi /etc/postfix/main.cf
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
mynetworks = 127.0.0.1
smtpd_recipient_restrictions =
permit_mynetworks,
permit_sasl_authenticated,
reject_unauth_destination
2.测试SMTP发信认证
printf "xiaoqi" | openssl base64
printf "123" | openssl base64
telnet localhost 25
ehlo localhost
auth login
mail from:lisi@lele.com
rcpt to:lisi@sohu.com
###至此SMTP发信认证已OK