Ubuntu+Sendmail+Dovecot+Openwebmail搭建邮件服务器
1.安装apache apt-get install apache2洛神 2.安装sendmail洛神 apt-get install sendmail #sasl2-bin已经同时安装,如果自己安装需要将/etc/default/saslauthd start=no 改为yes才能启动服务。 2.1设定Relay IP 在/etc/mail/access中添加允许Relay的地址 Connect:192.168.0.0 RELAY #允许192.168.0.0网络的IP地址通过sendmail发信,也可以写成192.168.0 2.2设置收信的域名 在/etc/mail/local-host-names中添加收信的域名 ssh.tw mail.ssh.tw 接收发往ssh.tw域和mail.ssh.tw域的邮件 2.3设置sendmail侦听范围,默认只侦听本机 编辑/etc/mail/sendmail.mc,按照下边内容修改: DAEMON_OPTIONS(`Family=inet, Name=MTA-v4, Port=smtp, Addr=0.0.0.0′)dnl DAEMON_OPTIONS(`Family=inet, Name=MSP-v4, Port=submission, M=Ea, Addr=0.0.0.0′)dnl 修改完成后使用一下命令使修改生效: m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf 2.5重启sendmail服务 /etc/init.d/sendmail restart 3.安装pop3服务 3.1需要的包:dovecot-common,dovecot-pop3d apt-get install dovecot-common dovecot-pop3d 3.2修改配置文件/etc/dovecot/dovecot.conf(不使用ssl配置方法) protocols = pop3 ssl=no mail_location = mbox:/var/mail:INBOX=/var/mail/%u 3.3重启dovecot服务 /etc/init.d/dovecot restart 3.4测试能否正常使用 telnet pop3_server 110 auth user user_name pass user_password 提示OK说明可以正常使用。 4.安装openwebmail 4.1下载openwebmail包 (地址:) 使用wget命令下载最新版的包到/tmp 4.2解压包到/var/www下 tar xvzf openwebmail.tar.gz -C /var/www 4.3安装所需要的包 apt-get install perl-suid #不安装无法执行pl脚本 apt-get install libapache2-mod-perl2 #安装后apache2可以支持cgi程序 4.4修改cgi-bin的默认路径 编辑/etc/apache2/sites-available/default,修改下边两行: ScriptAlias /cgi-bin/ /var/www/cgi-bin/ <Directory /var/www/cgi-bin> 修改后重启apache /etc/init.d/apace2 restart 4.5配置openwebmail所需要的配置文件: 4.5.1将/var/www/cgi-bin/openwebmail/etc/default/auth_unix.conf 复制到/var/www/cgi-bin/openwebmail/etc目录下,并修改以下两行: passwdfile_encrypted /etc/shadow passwdmkdb none 4.5.2将/var/www/cgi-bin/openwebmail/etc/default/dbm.conf 复制到/var/www/cgi-bin/openwebmail/etc/目录下,并修改以下一行: dbm_ext .pag 4.5.3修改/var/www/cgi-bin/openwebmail/etc/openwebmail.conf mailspooldir /var/mail ow_cgidir /var/www/cgi-bin/openwebmail ow_cgiurl /cgi-bin/openwebmail ow_htmldir /var/www/data/openwebmail ow_htmlurl /data/openwebmail default_language zh_CN.GB2312 default_iconset Cool3D.Chinese.Simplified #写不正确的话不显示图片 4.6运行以下命令配置openwebmail /var/www/cgi-bin/openwebmail/openwebmail-tool.pl –init 4.7设置软连接访问openwebmail 在/var/www下建立openwebmail文件夹并建立软连接 mkdir openwebmail cd openwebmail ln -s /var/www/data/openwebmail/redirect.html index.html 5.访问就可以访问openwebmail了。 6.发送邮件需要smtp认证的单独设置 6.1先来看一下/usr/lib/sasl2/Sendmail.conf文件里面的内容应该是pwcheck_method:saslauthd,将这个 文件复制成smtpd.conf,这个文件也要在/usr/lib/sasl2/目录下: cp Sendmail.conf smtpd.conf 6.2编辑sendmail.mc,添加以下两行 TRUST_AUTH_MECH(`DIGEST-MD5 LOGIN PLAIN’) 6.3使配置生效: m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf /etc/init.d/sendmail restart /etc/init.d/saslauthd restart 6.4注意事项 配置好后,可以使用smtp验证发送邮件,不使用smtp验证也能够发送邮件 原因:发送和接收邮件在域内,如果发送的邮件地址不在域内,则可能是 /etc/mail/access文件未清空。 解决:将 /etc/mail/access文件清空。 要注意的一点: 修改任何配置,需要重新启动sendmail。 亿恩科技地址(ADD):郑州市黄河路129号天一大厦608室 邮编(ZIP):450008 传真(FAX):0371-60123888 |