1、简要说明
简易安装postfix邮件服务器
2.1、mail:~#apt-get install postfix
安装,根据提示选"Internet Site"
Where should mail for root go填postfix
Mail name?填mail.wjjennluen.com
Other destinations to accept mail for?(blank for none)填mail.wjjennluen.com, localhost.wjjennleun.com, ,localhost
Force synchronous updates on mail queue?选否
2.2、检查postfix服务是不是已经运行
mail:~# netstat -ln|grep 25
tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN
tcp6 0 0 :::25 :::* LISTEN
unix 2 [ ACC ] STREAM LISTENING 20256 /tmp/.ICE-unix/11772
2.3、测试postfix
mail:~# telnet 127.0.0.1 25
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
220 mail.wjjennluen.com ESMTP Postfix (Debian/GNU)
ehlo mail
250-mail.wjjennluen.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250 8BITMIME
mail from: "This is a test mail!"<wxt@wjjennluen.com>
250 Ok
rcpt to:<wxt@wjjennleun.com>
250 Ok
data
354 End data with <CR><LF>.<CR><LF>
This is a test mail!
.
250 Ok: queued as 4888ACA0060
quit
221 Bye
Connection closed by foreign host.
好象是发出去了噢
2.4、检查刚发的邮件是否收到
mail:~#apt-get install mailx 下载mail阅读器
mail:~# su - wxt
wxt@mail~:$ mail
No mail for wxt
wxt@mail:~$exit
mail:~#:
my god,没有邮件啊
mail~:#more /var/mail/wxt
没有
mail~:#more /var/spool/mail/wxt
没有
咱回事呢
mail:~# telnet 127.0.0.1 25
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
220 mail.wjjennluen.com ESMTP Postfix (Debian/GNU)
ehlo mail
250-mail.wjjennluen.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250 8BITMIME
mail from: "abc"<wxt>
250 Ok
rcpt to: <wxt>
250 Ok
data
354 End data with <CR><LF>.<CR><LF>
abc
.
250 Ok: queued as 609D0CA00BB
quit
221 Bye
Connection closed by foreign host.
mail:~# more /var/mail/wxt
From wxt@mail.wjjennluen.com Sat Jul 2 18:33:56 2005
Return-Path: <wxt@mail.wjjennluen.com>
X-Original-To: wxt
Delivered-To: wxt@mail.wjjennluen.com
Received: from mail (localhost.localdomain [127.0.0.1])
by mail.wjjennluen.com (Postfix) with ESMTP id 609D0CA00BB
for <wxt>; Sat, 2 Jul 2005 18:33:42 +0800 (CST)
Message-Id: <20050702103342.609D0CA00BB@mail.wjjennluen.com>
Date: Sat, 2 Jul 2005 18:33:42 +0800 (CST)
From: wxt@mail.wjjennluen.com
To: undisclosed-recipients:;
abc
mail:~#
收到了,此时postfix工作在127.0.0.1上的,也就是localhost
查看mydestination参数的设定
mail:~# postconf |grep mydestination
mydestination = mail.wjjennluen.com, localhost.wjjennluen.com, , localhost
没有wjjennleun.com,所以用wxt@wjjennluen.com发信,postfix不会接受,所以要添加wjjennluen.com给mydestination
mail:~# postconf |grep mydestination
mydestination = mail.wjjennluen.com wjjennluen.com localhost.wjjennluen.com localhost
现在就可以收到了
mail:~#>/var/mail/wxt
mail:~# telnet 127.0.0.1 25
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
220 mail.wjjennluen.com ESMTP Postfix (Debian/GNU)
ehlo mail
250-mail.wjjennluen.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250 8BITMIME
mail from: "abc"<wxt@wjjennluen.com>
250 Ok
rcpt to: <wxt@wjjennluen.com>
250 Ok
data
354 End data with <CR><LF>.<CR><LF>
abc
.
250 Ok: queued as 609D0CA00BB
quit
221 Bye
Connection closed by foreign host.
mail:~# more /var/mail/wxt
From wxt@mail.wjjennluen.com Sat Jul 2 18:33:56 2005
Return-Path: <wxt@mail.wjjennluen.com>
X-Original-To: wxt
Delivered-To: wxt@mail.wjjennluen.com
Received: from mail (localhost.localdomain [127.0.0.1])
by mail.wjjennluen.com (Postfix) with ESMTP id 609D0CA00BB
for <wxt>; Sat, 2 Jul 2005 18:33:42 +0800 (CST)
Message-Id: <20050702103342.609D0CA00BB@mail.wjjennluen.com>
Date: Sat, 2 Jul 2005 18:33:42 +0800 (CST)
From: wxt@mail.wjjennluen.com
To: undisclosed-recipients:;
abc
mail:~#
2.5、安装pop3,imap
mail:~#apt-get install courier-pop courier-imap
注意/etc/courier/pop3d配置文件
注意/etc/courier/imapd配置文件
用outlook测试pop3和imap成功
2.6、安装apache,php,squirrelmail
mail:~#apt-get apache php4 php4-common squirrelmail
修改/etc/apache/httpd.conf
加入PHP支持
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
新建文件/var/www/test.php
<?php
phpinfo();
?>
在浏览器地址栏内输入http://192.168.0.15/test.php
可以确定PHP是否可以正常工作
2.7、从mailbox 更改为maildir
修改/etc/postfix/main.cf
增加参数设置
home_mailbox = Maildir/
更改mailbox_command 参数为
mailbox_command = /usr/bin/procmail -a "$EXTENSION" DEFAULT=$HOME/Maildir/
新增
MAILDIR=$HOME/Maildir
mail:~#cd /home/wxt/
mail:~#maildirmake Maildir
mail:~#chmod -R 750 Maildir
mail:~#ln -s /usr/share/squirrelmail /var/www/squirrelmail
修改/usr/share/squirrelmail/config/conf.pl内的变量$auto_create_special = ture;,让squirrelmail自动增加三个子目录
添加webmail虚拟主机(基于名子)
打开/etc/apache/httpd.conf
添加虚拟主机配置参数
NameVirtualHost 192.168.0.15
<VirtualHost 192.168.0.15>
ServerAdmin root@localhost
DocumentRoot /var/www/squirrelmail
ServerName webmail.wjjennluen.com
ErrorLog /var/log/apache/webmail/error.log
</VirtualHost>
mail:~#makdir /var/log/apache/webmail
mail:~#touch /var/log/apache/webmail/error.log
注意在named配置文件里面加入webmail.wjjennluen.com的记录
在浏览器的地址栏内输入webmail.wjjennluen.com就可以登陆webmail了
2.7、给postfix 加上smtp 认证
mail:~# apt-get install postfix-tls sasl2-bin libsasl2-modules
修改/etc/default/saslauthd文件,设定START = yes
修改/etc/postfix/sasl/smtpd.conf,设定saslauthd来认证smtp
mail:~#mkdir /etc/postfix/sasl
mail:~#echo "pwcheck_method: saslauthd" > /etc/postfix/sasl/smtpd.con
添加帐户postfix到sasl组
mail:~#addgroup postfix sasl
修改/etc/postfix/main.cf, 使postfix使用sasl来实现smtp验证功能
#=====sasl======#
smtpd_sasl_auth_enable = yes
broken_sasl_auth_clients = yes
smtpd_sasl_security_options = noanonymous
smtpd_recipient_restrictions = permit_sasl_authenticated, permit_mynetworks, check_relay_domains, reject_unauth_destination
smtpd_client_restrictions = permit_sasl_authenticated
修改/etc/postfix/master.cf,让postfix不要以chroot启动,参数-v可以用来debug,正式上线为了不使大量的log,一定要拿掉
# ==============================================
# service type private unpriv chroot wakeup maxproc command + args
# (yes) (yes) (yes) (never) (100)
# ==============================================
smtp inet n - n - - smtpd -v
重新启动sasl 验证程序
mail:~# /etc/init.d/saslauthd restart
重新启动postfix
mail:~#/etc/init.d/postfix restart
mail:~# testsaslauthd -u wxt -p wxt
0: OK "Success."
测试sasl验证程序可以正常工作了
把帳號及密碼轉換成 base64 的編碼:(可能需要安裝 libmime-base64-perl 套件)
mail:~# perl -MMIME::Base64 -e 'print encode_base64("wxtwxtsuperwxt");' d3h0AHd4dABzdXBlcnd4dA==
mail:~# telnet 127.0.0.1 25
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
220 mail.wjjennluen.com ESMTP Postfix (Debian/GNU)
ehlo mail
250-mail.wjjennluen.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-AUTH NTLM LOGIN PLAIN DIGEST-MD5 CRAM-MD5
250-AUTH=NTLM LOGIN PLAIN DIGEST-MD5 CRAM-MD5
250 8BITMIME
auth plain d3h0AHd4dABzdXBlcnd4dA==
235 Authentication successful
quit
221 Bye
Connection closed by foreign host.
mail:~#
转去outlook设置OK
OK,SMTP认证完成
自由广告区 |
分类导航 |
邮件新闻资讯: IT业界 | 邮件服务器 | 邮件趣闻 | 移动电邮 电子邮箱 | 反垃圾邮件|邮件客户端|网络安全 行业数据 | 邮件人物 | 网站公告 | 行业法规 网络技术: 邮件原理 | 网络协议 | 网络管理 | 传输介质 线路接入 | 路由接口 | 邮件存储 | 华为3Com CISCO技术 | 网络与服务器硬件 操作系统: Windows 9X | Linux&Uinx | Windows NT Windows Vista | FreeBSD | 其它操作系统 邮件服务器: 程序与开发 | Exchange | Qmail | Postfix Sendmail | MDaemon | Domino | Foxmail KerioMail | JavaMail | Winwebmail |James Merak&VisNetic | CMailServer | WinMail 金笛邮件系统 | 其它 | 反垃圾邮件: 综述| 客户端反垃圾邮件|服务器端反垃圾邮件 邮件客户端软件: Outlook | Foxmail | DreamMail| KooMail The bat | 雷鸟 | Eudora |Becky! |Pegasus IncrediMail |其它 电子邮箱: 个人邮箱 | 企业邮箱 |Gmail 移动电子邮件:服务器 | 客户端 | 技术前沿 邮件网络安全: 软件漏洞 | 安全知识 | 病毒公告 |防火墙 攻防技术 | 病毒查杀| ISA | 数字签名 邮件营销: Email营销 | 网络营销 | 营销技巧 |营销案例 邮件人才:招聘 | 职场 | 培训 | 指南 | 职场 解决方案: 邮件系统|反垃圾邮件 |安全 |移动电邮 |招标 产品评测: 邮件系统 |反垃圾邮件 |邮箱 |安全 |客户端 |