Mail搭建邮件服务器(Postfix+Dovcot+Mysql+Roundcubemail)
Posted H__D
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Mail搭建邮件服务器(Postfix+Dovcot+Mysql+Roundcubemail)相关的知识,希望对你有一定的参考价值。
大纲
一、mail部署说明
二、安装准备
三、LMAP环境配置
四、配置postfixadmin
五、配置postfix
六、配置dovecot
七、测试SMTP和POP3服务
八、配置Roundcubemail
一、mail部署说明
- 操作系统:Linux(CentOS6.5)
- 本例采用的是LAMP+Postfix+Dovcot+PostfixAdmin+Roundcubemail搭建的邮件服务器。阅读本例请先参考:【Mail】邮件的基础知识和原理。
LAMP一种软件环境,Postfix:一种邮件传输代理软件,通常用来发送邮件;Dovcot:邮件检索代理软件,通常用来接收邮件;PostfixAdmin:是一个基于Web的 Postfix 邮件发送服务器的管理工具;Roundcubemail:采用php+Ajax开发并且需要mysql数据库来存储数据的email客户端。 - 邮件发送和接收流程如下图:
发送流程:客户端Mail Client发出邮件 ——> Postfix接收,通过Dovecot进行认证(查询数据库是否存在用户) ——> Dovecot把邮件存放在本地 (Mail Dir)
接收流程:客户端WebMail发出获取邮件请求 ——> Dovecot接收请求,验证用户(查询数据库是否存在用户)——> Dovecot把邮件从本地拿出,交给客户端。
二、安装准备
- 添加DNS解析记录
- 先添加 A 记录 mail.yourdomain.com 解析为你的邮件服务器IP
- 再添加 MX 记录指向 mail.yourdomain.com
- 关闭防火墙与SELinux
- 关闭防火墙命令:service iptables stop
- 关闭SELinux命令:vim /etc/selinux/config
- 配置hostname
- 修改主机名命令:vim /etc/sysconfig/network
- 修改主机名命令:vim /etc/sysconfig/network
- 配置软件源
- 配置好yun,保证云能正常安装软件
-
创建一个vmail用户,用作管理虚拟邮箱的文件夹
useradd
-u 2000 -d
/var/vmail
-m -s
/sbin/nologin
vmail
三、LMAP环境配置
- LAMP环境配置请参照:【Linux】LAMP环境的搭建;本例的环境:
- 并安装好phpMyAdmin,参照:【Mysql】phpMyAdmin安装与配置。
四、配置postfixadmin
- 下载postfixadmin,地址:https://sourceforge.net/projects/postfixadmin/,本例使用的是postfixadmin-2.93.tar.gz。
- 解压到apache的网页目录(/var/www/html/)并修改文件名:
1 [root@mail ~]# tar xf postfixadmin-2.93.tar.gz -C /var/www/html/ 2 [root@mail ~]# cd /var/www/html/ 3 [root@mail html]# ls 4 index.php postfixadmin-2.93 5 [root@mail html]# mv postfixadmin-2.93 postfixadmin 6 [root@mail html]# ls 7 index.php postfixadmin 8 [root@mail html]#
- 配置并测试
1 [root@mail html]# cd postfixadmin/ 2 #修改前先备份一下配置文件 3 [root@mail postfixadmin]# cp config.inc.php config.inc.php.bak 4 [root@mail postfixadmin]# cp setup.php setup.php.bak 5 [root@mail postfixadmin]# vim config.inc.php 6 #找到下面几行并修改 7 $CONF[\'configured\'] = true; 8 $CONF[\'database_type\'] = \'mysql\'; 9 $CONF[\'database_host\'] = \'localhost\'; 10 $CONF[\'database_user\'] = \'postfix\'; 11 $CONF[\'database_password\'] = \'postfix\'; 12 $CONF[\'database_name\'] = \'postfix\'; 13 $CONF[\'admin_email\'] = \'postmaster@free.com\'; 14 $CONF[\'encrypt\'] = \'dovecot:CRAM-MD5\'; 15 $CONF[\'dovecotpw\'] = "/usr/bin/doveadm pw"; 16 $CONF[\'domain_path\'] = \'YES\'; 17 $CONF[\'domain_in_mailbox\'] = \'NO\'; 18 $CONF[\'aliases\'] = \'1000\'; 19 $CONF[\'mailboxes\'] = \'1000\'; 20 $CONF[\'maxquota\'] = \'1000\'; 21 $CONF[\'fetchmail\'] = \'NO\'; 22 $CONF[\'quota\'] = \'YES\'; 23 $CONF[\'used_quotas\'] = \'YES\'; 24 $CONF[\'new_quota_table\'] = \'YES\';
- 为postfixadmin创建Mysql数据库与权限记录
- 启动数据库,进入数据库
- 创建postfix数据库,并创建postfix用户且授权
1 mysql> create database postfix; 2 mysql> grant all on postfix.* to postfix@\'localhost\' identified by \'postfix\'; 3 mysql> flush privileges;
- 测试postfix能否登录成功。
1 [root@mail html]# mysql -u postfix -p 2 Enter password: 3 Welcome to the MySQL monitor. Commands end with ; or \\g. 4 Your MySQL connection id is 53806 5 Server version: 5.6.31 MySQL Community Server (GPL) 6 7 Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. 8 9 Oracle is a registered trademark of Oracle Corporation and/or its 10 affiliates. Other names may be trademarks of their respective 11 owners. 12 13 Type \'help;\' or \'\\h\' for help. Type \'\\c\' to clear the current input statement. 14 15 mysql> show databases; 16 +--------------------+ 17 | Database | 18 +--------------------+ 19 | information_schema | 20 | postfix | 21 | test | 22 +--------------------+ 23 3 rows in set (0.00 sec) 24 mysql> use postfix 25 Database changed 26 mysql>
- postfixadmin具体配置流程
- 启动apache,由浏览器进入postfix项目的设置界面,地址:http://ip:端口/postfixadmin/setup.php
注:检查PHP环境,并初始化数据库 - 可以看出上面步骤在跟新了数据库postfix
- 创建设置密码,修改配置文件的设置密码
点击生成hash码秘钥(Generate password hash)。 - 刷新界面,设置超级管理员账号
- 点击新增,应该会出现错误,说没有dovecotpw,是因为我们还没安装dovecot。
- 这里先来安装一下dovecot,后面再进行配置!
1 [root@mail postfixadmin]# yum install -y dovecot dovecot-devel dovecot-mysql 2 [root@mail postfixadmin]# chkconfig dovecot on #加入开机自启动 3 [root@mail postfixadmin]# chkconfig dovecot --list 4 dovecot 0:关闭 1:关闭 2:启用 3:启用 4:启用 5:启用 6:关闭 5 [root@mail postfixadmin]#
- 再来设置一下管理员的账户与密码
- 进入postfixadmin登入界面,地址:http://ip:端口/postfixadmin/login.php,输入管理员账号和密码登录
- 启动apache,由浏览器进入postfix项目的设置界面,地址:http://ip:端口/postfixadmin/setup.php
- postfxiadmin不能自动创建目录,得增加自动建立目录的功能
- 建立创建虚拟邮箱脚本,脚本名称 /usr/local/bin/maildir-creation.sh,脚本内容如下:
注:邮件文件就保存在HOME_DIR(及/var/vamai)中,自己可以下载查看
1 [root@mail ~]#vim /usr/local/bin/maildir-creation.sh 2 #!/bin/bash 3 # 4 HOME_DIR="/var/vmail" 5 USER_NAME="vmail" 6 GROUP_NAME="vmail" 7 if [ ! -d ${HOME_DIR}/$1 ] ; then 8 mkdir ${HOME_DIR}/$1 9 chown -R ${USER_NAME}.${GROUP_NAME} ${HOME_DIR}/$1 10 fi 11 mkdir ${HOME_DIR}/$1/$2 12 chown -R ${USER_NAME}.${GROUP_NAME} ${HOME_DIR}/$1/$2
- 建立删除虚拟邮箱脚本,脚本名称 /usr/local/bin/maildir-deletion.sh ,脚本内容如下:
1 [root@mail ~]#vim /usr/local/bin/maildir-deletion.sh 2 #!/bin/bash 3 # 4 # vmta ALL = NOPASSWD: /usr/local/bin/maildir-deletion.sh 5 # 6 if [ $# -ne 2 ] ; then 7 exit 127 8 fi 9 DOMAIN="$1" 10 USER="$2" 11 HOME_DIR="/var/vmail" 12 USER_DIR="${HOME_DIR}/${DOMAIN}/${USER}" 13 TRASH_DIR="${HOME_DIR}/deleted-maildirs" 14 DATE=`date "+%Y%m%d_%H%M%S"` 15 if [ ! -d "${TRASH_DIR}/${DOMAIN}" ] ; then 16 mkdir -p "${TRASH_DIR}/${DOMAIN}" 17 fi 18 if [ -d "${USER_DIR}" ] ; then 19 mv ${USER_DIR} ${TRASH_DIR}/${DOMAIN}/${USER}-${DATE} 20 fi
- 建立创建虚拟邮箱脚本,脚本名称 /usr/local/bin/maildir-creation.sh,脚本内容如下:
- 建立删除目录
1 [root@mail ~]# mkdir /var/vmail/deleted-maildirs 2 [root@mail ~]# chown -R vmail.vmail /var/vmail/deleted-maildirs/
- 赋予脚本可执行权限
1 [root@mail ~]# chmod 750 /usr/local/bin/maildir-* 2 [root@mail ~]# chown vmail.vmail /usr/local/bin/maildir-*
- 配置sudo
1 [root@mail ~]#vim /etc/sudoers 2 #在 /etc/sudoers 最后增加两行 3 vmail ALL = NOPASSWD: /usr/local/bin/maildir-creation.sh 4 vmail ALL = NOPASSWD: /usr/local/bin/maildir-deletion.sh 5 #在/etc/sudoers 注释掉下面内容 6 #Defaults requiretty 7 :wq! #由于这个文件是只读的,所以得强制保存并退出
- 修改postfixadmin的相关文件
1 [root@mail ~]# cd /var/www/html/postfixadmin/ 2 [root@mail postfixadmin]# vim create-mailbox.php 3 修改create-mailbox.php 文件,229行内容应该是: 4 db_log ($SESSID_USERNAME, $fDomain, \'create_mailbox\', "$fUsername"); 5 在该行前面增加下面一行, 6 system("sudo /usr/local/bin/maildir-creation.sh $fDomain ".$_POST[\'fUsername\']); 7 [root@mail postfixadmin]# vim delete.php 8 修改delete.php 文件,146行内容应该是, 9 db_log ($SESSID_USERNAME, $fDomain, \'delete_mailbox\', $fDelete); 10 在该行下面增加下面4行, 11 $userarray=explode("@",$fDelete); 12 $user=$userarray[0]; 13 $domain=$userarray[1]; 14 system("sudo /usr/local/bin/maildir-deletion.sh $domain $user");
------------------------------至此postfixadmin配置全部完成---------------------------
五、配置Postfix
注:Postfix用CentOS6.5系统自带的,因为CentOS6.5里面的postfix包已经支持mysql
- 查看postfix版本
1 [root@mail deleted-maildirs]# rpm -qa | grep postfix 2 postfix-2.6.6-6.el6_7.1.x86_64
- 修改postfix的配置文件
1 [root@mail ~]# vim /etc/postfix/main.cf 2 #基本配置 3 myhostname = mail.yourdomain.com 4 mydomain = yourdomain.com 5 myorigin = $mydomain 6 inet_interfaces = all 7 mynetworks_style = host 8 mynetworks = 192.168.18/24, 127.0.0.0/8 9 #虚拟域名配置 10 virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql_virtual_domains_maps.cf 11 virtual_alias_maps = proxy:mysql:/etc/postfix/mysql_virtual_alias_maps.cf 12 virtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf 13 # Additional for quota support 14 virtual_create_maildirsize = yes 15 virtual_mailbox_extended = yes 16 virtual_mailbox_limit_maps = mysql:/etc/postfix/mysql_virtual_mailbox_limit_maps.cf 17 virtual_mailbox_limit_override = yes 18 virtual_maildir_limit_message = Sorry, this user has exceeded their disk space quota, please try again later. 19 virtual_overquota_bounce = yes 20 #Specify the user/group that owns the mail folders. I\'m not sure if this is strictly necessary when using Dovecot\'s LDA. 21 virtual_uid_maps = static:2000 22 virtual_gid_maps = static:2000 23 #Specifies which tables proxymap can read: http://www.postfix.org/postconf.5.html#proxy_read_maps 24 proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $virtual_mailbox_limit_maps 25 [root@mail ~]# postconf #检查配置文件是否有错误
- 创建Mysql脚本
- 创建/etc/postfix/mysql_virtual_domains_maps.cf文件
1 [root@mail ~]# vim /etc/postfix/mysql_virtual_domains_maps.cf 2 user = postfix 3 password = postfix 4 hosts = localhost 5 dbname = postfix 6 query = SELECT domain FROM domain WHERE domain=\'%s\' AND active = \'1\' 7 #optional query to use when relaying for backup MX 8 #query = SELECT domain FROM domain WHERE domain=\'%s\' AND backupmx = \'0\' AND active = \'1\'
- 创建/etc/postfix/mysql_virtual_alias_maps.cf文件
1 [root@mail ~]# vim /etc/postfix/mysql_virtual_alias_maps.cf 2 user = postfix 3 password = postfix 4 hosts = localhost 5 dbname = postfix 6 query = SELECT goto FROM alias WHERE address=\'%s\' AND active = \'1\'
- 创建/etc/postfix/mysql_virtual_mailbox_maps.cf文件
1 [root@mail ~]# vim /etc/postfix/mysql_virtual_mailbox_maps.cf 2 user = postfix 3 password = postfix 4 hosts = localhost 5 dbname = postfix 6 query = SELECT CONCAT(domain,\'/\',maildir) FROM mailbox WHERE username=\'%s\' AND active = \'1\'
- 创建/etc/postfix/mysql_virtual_mailbox_limit_maps.cf文件
1 [root@mail ~]# vim /etc/postfix/mysql_virtual_mailbox_limit_maps.cf 2 user = postfix 3 password = postfix 4 hosts = localhost 5 dbname = postfix 6 query = SELECT quota FROM mailbox WHERE username=\'%s\' AND active = \'1\'
- 创建/etc/postfix/mysql_virtual_domains_maps.cf文件
- SMTP 认证设定
SMTP(Simple Mail Transfer Protocol)即简单邮件传输协议,它是一组用于由源地址到目的地址传送邮件的规则,由它来控制信件的中转方式
- 查看postfix支持的认证,默认支持dovecot
-
1 [root@mail ~]# postconf -a 2 cyrus 3 dovecot
- 修改/etc/postfix/main.cf配置文件
1 [root@mail ~]#vim /etc/postfix/main.cf 2 #SASL SUPPORT FOR CLIENTS 3 # Turns on sasl authorization 4 smtpd_sasl_auth_enable = yes 5 #Use dovecot for authentication 6 smtpd_sasl_type = dovecot 7 # Path to UNIX socket for SASL 8 smtpd_sasl_path = /var/run/dovecot/auth-client 9 #Disable anonymous login. We don\'t want to run an open relay for spammers. 10 smtpd_sasl_security_options = noanonymous 11 #Adds support for email software that doesn\'t follow RFC 4954. 12 #This includes most versions of Microsoft Outlook before 2007. 13 broken_sasl_auth_clients = yes 14 # 15 smtpd_recipient_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_unauth_destination
- 使用Dovecot做为投递
1 [root@mail ~]# vim /etc/postfix/main.cf 2 # TRANSPORT MAP 3 virtual_transport = dovecot 4 dovecot_destination_recipient_limit = 1 5 #修改master.cf文件 6 [root@mail ~]# vim /etc/postfix/master.cf 7 #在最后增加这两行,注意flags前面有两个空格,不然会报错 8 dovecot unix - n n - - pipe, 9 flags=DRhu user=vmail:vmail argv=/usr/libexec/dovecot/dovecot-lda -f ${sender} -d ${recipient}
------------------------------至此postfix配置全部完成---------------------------
六、配置Dovecot
- 前面已经安装了dovecot,现在配置dovecot的配置文件
- 修改/etc/dovecot/dovecot.conf #主配置文件
1 [root@mail ~]# vim /etc/dovecot/dovecot.conf 2 protocols = imap pop3 3 listen = * 4 dict { 5 quota = mysql:/etc/dovecot/dovecot-dict-sql.conf.ext 6 } 7 !include conf.d/*.conf
- 修改/etc/dovecot/conf.d/10-auth.conf
1 [root@mail ~]# vim /etc/dovecot/conf.d/10-auth.conf 2 disable_plaintext_auth = no 3 auth_mechanisms = plain login cram-md5 4 !include auth-sql.conf.ext
- 修改/etc/dovecot/conf.d/10-mail.conf
1 [root@mail ~]# vim /etc/dovecot/conf.d/10-mail.conf 2 mail_location = maildir:%hMaildir 3 mbox_write_locks = fcntl
- 修改/etc/dovecot/conf.d/10-master.conf
1 [root@mail ~]# vim /etc/dovecot/conf.d/10-master.conf 2 service imap-login { 3 inet_listener imap { 4 } 5 inet_listener imaps { 6 } 7 } 8 service pop3-login { 9 inet_listener pop3 { 10 } 11 inet_listener pop3s { 12 } 13 } 14 service lmtp { 15 unix_listener lmtp { 16 } 17 } 18 service imap { 19 } 20 service pop3 { 21 } 22 service auth { 23 unix_listener auth-userdb { 24 mode = 0600 25 user = vmail 26 group = vmail 27 } 28 #新加下面一段,为smtp做认证 29 unix_listener auth-client { 30 mode = 0600 31 user = postfix 32 group = postfix 33 } 34 } 35 service auth-worker { 36 } 37 service dict { 38 unix_listener dict { 39 mode = 0600 40 user = vmail 41 group = vmail 42 } 43 }
- 修改/etc/dovecot/conf.d/15-lda.conf
1 [root@mail ~]# vim /etc/dovecot/conf.d/15-lda.conf 2 protocol lda { 3 mail_plugins = quota 4 postmaster_address = postmaster@free.com #管理员邮箱 5 }
- 修改/etc/dovecot/conf.d/20-imap.conf
1 [root@mail ~]# vim /etc/dovecot/conf.d/20-imap.conf 2 protocol imap { 3 mail_plugins = quota imap_quota 4 }
- 修改/etc/dovecot/conf.d/20-pop3.conf
1 [root@mail ~]# vim /etc/dovecot/conf.d/20-pop3.conf 2 protocol pop3 { 3 pop3_uidl_format = %08Xu%08Xv 4 mail_plugins = quota 5 }
- 修改/etc/dovecot/conf.d/90-quota.conf
1 [root@mail ~]# vim /etc/dovecot/conf.d/90-quota.conf 2 plugin { 3 quota_rule = *:storage=1G 4 } 5 plugin { 6 } 7 plugin { 8 quota = dict:User quota::proxy::quota 9 } 10 plugin { 11 }
- 增加/etc/dovecot/dovecot-sql.conf.ext
1 [root@mail ~]# vim /etc/dovecot/dovecot-sql.conf.ext 2 driver = mysql 3 connect = host=localhost dbname=postfix user=postfix password=postfix 4 default_pass_scheme = CRAM-MD5 5 user_query = SELECT CONCAT(\'/var/vmail/\', maildir) AS home, 2000 AS uid, 2000 AS gid, CONCAT(\'*:bytes=\', quota) as quota_rule FROM mailbox WHERE username = \'%u\' AND active=\'1\' 6 password_query = SELECT username AS user, password, CONCAT(\'/var/vmail/\', maildir) AS userdb_home, 2000 AS userdb_uid, 2000 AS userdb_gid, CONCAT(\'*:bytes=\', quota) as userdb_quota_rule FROM mailbox WHERE username = \'%u\' AND active=\'1\'
- 增加/etc/dovecot/dovecot-dict-sql.conf.ext
1 [root@mail ~]# vim /etc/dovecot/dovecot-dict-sql.conf.ext 2 connect = host=localhost dbname=postfix user=postfix password=postfix 3 map { 4 pattern = priv/quota/storage 5 table = quota2 6 username_field = username 7 value_field = bytes 8 } 9 map { 10 pattern = priv/quota/messages 11 table = quota2 12 username_field = username 13 value_field = messages 14 }
- 修改/etc/dovecot/dovecot.conf #主配置文件
- 重新启动postfix和dovecot服务
1 [root@mail ~]# service postfix restart 2 关闭 postfix: [确定] 3 启动 postfix: [确定] 4 [root@mail ~]# service dovecot restart 5 停止 Dovecot Imap: [失败] 6 正在启动 Dovecot Imap: [确定]
------------------------------至此dovecot配置全部完成---------------------------
七、测试SMTP和POP3服务
- 登录postfixadmin,地址http://ip:端口/postfixadmin/login.php,创建虚拟域
- 创建测试邮箱
- 使用telnet 进行测试
请参照:【Mail】telnet收发邮件过程
八、配置Roundcubemail
- 下载Roundcubemail(注意下载roundcubmail版本与php版本的兼容问题,本例使用的是roundcubemail-0.9.0.tar.gz),地址:https://roundcube.net,并且解压到apache目录中
1 [root@mail ~]# tar -xf roundcubemail-0.9.0.tar.gz -C /var/www/html/ 2 [root@mail ~]# cd /var/www/html/ 3 [root@mail html]# ls 4 admin index.php phpmyadmin roundcubemail-0.9.0 5 [root@mail html]# mv roundcubemail-0.9.0 webmail 6 [root@mail html]# ls 7 admin index.php phpmyadmin webmail 8 [root@mail html]#
- 在浏览器中访问roundcubemail的安装界面,地址:http://ip:端口/webmail/installer
- 从上面可以看出时区有问题,其他都ok。所以修改php的配置文件。
- 修改php.ini
1 [root@mail installer]# vim /etc/php.ini 2 date.timezone = Asia/Shanghai
- 修改apache中PHPini的位置,并重启apache服务
1 [root@mail installer]# vim /etc/httpd/conf/httpd.conf 2 PHPIniDir "/etc/php.ini" 3 [root@mail installer]# service httpd restart 4 Stopping httpd: [ OK ] 5 Starting httpd: [ OK ] 6 [root@mail installer]#
- 修改php.ini
- 修改所有Web文件的所属者与所属组
1 [root@mail ~]# cd /var/www/html/ 2 [root@mail html]# ll 3 total 16 4 drwxrwxr-x 14 1000 1010 4096 Jul 11 05:25 admin 5 -rw-r--r-- 1 root root 18 Jul 11 04:12 index.php 6 drwxr-xr-x 9 root root 4096 Jul 11 04:17 phpmyadmin 7 drwxr-xr-x 11 501 80 4096 Jun 16 23:10 webmail 8 [root@mail html]# chown -R vmail.vmail admin 9 [root@mail html]# chown -R vmail.vmail phpmyadmin 10 [root@mail html]# chown -R vmail.vmail webmail
- 查看session保存位置
1 [root@mail html]# vim /etc/php.ini 2 session.save_path = "/var/lib/php/session"
- 修改session文件的所属组
1 [root@mail html]# cd /var/lib/php/ 2 [root@mail php]# ll 3 total 4 4 drwxrwx--- 2 root apache 4096 Feb 22 10:56 session 5 [root@mail php]# chown -R .vmail session/ 6 [root@mail php]# ll 7 total 4 8 drwxrwx--- 2 root vmail 4096 Feb 22 10:56 session 9 [root@mail php]#
- 刷新roundcubemail的安装界面,地址:http://ip:端口/webmail/installer
- 点击NEXT,进行相关配置(下面是必须配置的选项)
- 配置webmail的显示名称
- 配置Webmail数据库相关(用户名和密码都是roundcude)
- 配置IMAP
- 配置SMTP服务器
- 配置完成效果如下,(配置好的选项都被列出来了,我们得下载两个配置文件main.inc.php和db.inc.php并上传到时服务器中)
- 上传至服务器相关目录中
1 [root@mail ~]# cd /var/www/html/webmail/config/ 2 [root@mail config]# ll 3 total 92 4 -rw-r--r-- 1 root root 2905 Jul 10 22:15 db.inc.php 5 -rw-r--r-- 1 vmail vmail 2893 Jun 16 23:10 db.inc.php.dist 6 -rw-r--r-- 1 root root 38438 Jul 10 22:15 main.inc.php 7 -rw-r--r-- 1 vmail vmail 38414 Jun 16 23:10 main.inc.php.dist 8 -rw-r--r-- 1 vmail vmail 2731 Jun 16 23:10 mimetypes.php 9 [root@mail config]#
- 给WebMail授权
1 mysql> CREATE DATABASE roundcubemail; 2 Query OK, 1 row affected (0.00 sec) 3 mysql> GRANT ALL PRIVILEGES ON roundcubemail.* TO roundcubemail@localhost IDENTIFIED BY \'roundcubemail\'; 4 FLUSH PRIVILEGES;Query OK, 0 rows affected (0.01 sec) 5 mysql> FLUSH PRIVILEGES; 6 Query OK, 0 rows affected (0.00 sec)
- 配置webmail的显示名称
- 单击CONTINUE继续
- 单击初始化数据库按钮
- 初始化完成并用phpmyadmin查看数据库
- 进行WebMail测试,地址:http://ip:端口/webmail,输入在postfixadmin中新增的邮箱账号和密码。
在roundcube里面即可发送邮件也可以接收邮件,就是一个网页邮件客户端。roundcude还有丰富的插件,可以自行百度安装。
------------------------------至此roundcubemail配置全部完成---------------------------
以上是关于Mail搭建邮件服务器(Postfix+Dovcot+Mysql+Roundcubemail)的主要内容,如果未能解决你的问题,请参考以下文章
Postfix + Sasl + Courier-Authlib + MySQL + Dovecot + Webmail搭建邮件服务器