扫二维码与项目经理沟通
我们在微信上24小时期待你的声音
解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流
前言 extmail是一款开源的webmail系统。 现有的基于extmail的部署架构有如下两种模式:
创新互联公司服务项目包括剑阁网站建设、剑阁网站制作、剑阁网页制作以及剑阁网络营销策划等。多年来,我们专注于互联网行业,利用自身积累的技术优势、行业经验、深度合作伙伴关系等,向广大中小型企业、政府机构等提供互联网行业的解决方案,剑阁网站推广取得了明显的社会效益与经济效益。目前,我们服务的客户以成都为中心已经辐射到剑阁省份的部分城市,未来相信会继续扩大服务区域并继续获得客户的支持与信任!第一种:postfix + extmail + devocot + courier-authdaemon 第二种:postfix + extmail + courier-authdaemon + courier-imap + courier-pop3 + maildrop 本次部署基于第二种模式进行配置 部署 部署环境 OS:ubuntu 11.04 server Extmail:1.2 Extman:1.1 依赖包安装 apt-get install mysql-client-5.1 mysql-server apache2 postfix postfix-mysql postfix-doc courier-authdaemon courier-authlib-mysql courier-pop courier-pop-ssl courier-imap courier-imap-ssl libsasl2-modules libsasl2-modules-sql sasl2-bin libpam-mysql openssl libapache2-mod-fastcgi libfcgi-perl build-essential libtool libnet-server-perl libnet-cidr-perl libberkeleydb-perl arc zoo lzop liblzo2-dev libstdc++5 libgd-gd2-perl libfile-tail-perl libdigest-sha1-perl libdigest-HMAC-perl libnet-ip-perl libnet-dns-perl libhtml-tagset-perl libhtml-parser-perl libio-stringy-perl libio-multiplex-perl libio-socket-ssl-perl libio-zlib-perl libnet-ssleay-perl libunix-syslog-perl libtimedate-perl libmailtools-perl libconvert-binhex-perl libconvert-tnef-perl libconvert-uulib-perl libcompress-zlib-perl libarchive-zip-perl libarchive-tar-perl perl-suid 下载extmail和extman google一下即可找到官方下载地址,下载最新版本,可能看到文档的时候我这个版本已经不是最新,直接下最新的即可。 下载完毕之后将文档解压到/var/www/extsuite/extmail和/var/www/extsuite/extman 将postfix需要使用的虚拟主机的配置文件拷贝到postfix的etc文件夹下面 cp /var/www/extsuite/extman/docs/mysql_virtual_*.cf /etc/postfix/ 用户分配 特别说明:因为extmail系统里面使用的用户的uid和gid都是1000,如果你使用的ubuntu系统初始化一个admin用户,这个用户的 uid和gid就是1000,但是你又不想用此用户作为extmail的运行用户,那就必须新建一个用户,然后将此用户的uid和gid与初始化用户替 换。 useradd -m -d /home/www -s /bin/bash www passwd www 以上新建用户的uid和pid都是1001,可以修改passwd文件和group文件进行替换。 文件属性修改 chmod 755 /etc/postfix/mysql_virtual_*.cf chgrp postfix /etc/postfix/mysql_virtual_*.cf chown -R www:www /var/www/extsuite/extmail/cgi/ chown -R www:www /var/www/extsuite/extman/cgi/ cd /var/www/extsuite/extmail/ cp webmail.cf.default webmail.cf cd /var/www/extsuite/extman/ cp webman.cf.default webman.cf 修改extmail配置文件 vim /var/www/extsuite/extmail/webmail.cf SYS_USER_LANG = zh_CN # 语言设置 SYS_MYSQL_USER = extmail # 默认访问数据库的用户名 SYS_MYSQL_PASS = extmail # 默认访问数据库的密码 SYS_MYSQL_DB = extmail # 默认访问数据库的名字 SYS_MYSQL_SOCKET = /var/run/mysqld/mysqld.sock SYS_AUTHLIB_SOCKET = /var/run/courier/authdaemon/socket SYS_MAILDIR_BASE = /home/vmail SYS_MESSAGE_SIZE_LIMIT = 102400000 vim /var/www/extsuite/extman/webman.cf SYS_CAPTCHA_ON = 0 ##用于关闭后台登录时的验证码 SYS_MAILDIR_BASE = /home/vmail SYS_MYSQL_SOCKET = /var/run/mysqld/mysqld.sock SYS_LANG = zh_CN SYS_GROUPMAIL_SENDER = admin@1k8k.com vim /var/www/extsuite/extman/contrib/passwd2ext.pl my $sock = \'/var/run/mysqld/mysqld.sock\'; Extmail 数据库初始化 直接导入sql脚本 mysql -u root -pgaojinbo.com < /var/www/extsuite/extman/docs/extmail.sql mysql -u root -pgaojinbo.com < /var/www/extsuite/extman/docs/init.sql 临时文件夹建立 mkdir /tmp/extman chown -R www:www /tmp/extman 初始化postmaster@extmail.org帐户的Maildir文件夹 cd /var/www/extsuite/extman/tools ./maildirmake.pl /home/vmail/extmail.org/postmaster/Maildir chown -R www:www /home/vmail/extmail.org/ postfix配置 # See /usr/share/postfix/main.cf.dist for a commented, more complete version # Debian specific: Specifying a file name will cause the first # line of that file to be used as the name. The Debian default # is /etc/mailname. #myorigin = /etc/mailname smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu) biff = no # appending .domain is the MUA\'s job. append_dot_mydomain = no # Uncomment the next line to generate "delayed mail" warnings #delay_warning_time = 4h readme_directory = /usr/share/doc/postfix # TLS parameters smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key smtpd_use_tls=no smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache # See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for # information on enabling SSL in the smtp client. mydomain = 1k8k.com myhostname = mail.1k8k.com alias_maps = hash:/etc/aliases alias_database = hash:/etc/aliases myorigin = /etc/mailname mydestination = 127.0.0.1,mail.1k8k.com relayhost = mynetworks = 127.0.0.1 mailbox_size_limit = 0 recipient_delimiter = + inet_interfaces = loopback-only html_directory = /usr/share/doc/postfix/html ######### virtual config############ virtual_alias_domains = virtual_alias_maps = mysql:/etc/postfix/mysql_virtual_alias_maps.cf virtual_mailbox_domains = mysql:/etc/postfix/mysql_virtual_domains_maps.cf virtual_mailbox_maps = mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf virtual_mailbox_limit_maps = mysql:/etc/postfix/mysql_virtual_limit_maps.cf virtual_mailbox_base = /home/vmail virtual_uid_maps = static:1000 virtual_gid_maps = static:1000 virtual_create_maildirsize = yes virtual_mailbox_extended = yes virtual_overquota_bounce = yes virtual_mailbox_limit_override = yes virtual_maildir_limit_message = Sorry, the your Maildir has overdrawn your diskspace quota, please free up some of spaces of your ma ilbox try again. proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mai lbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $ transport_maps $mynetworks $virtual_mailbox_limit_maps ###########SMTP AUTH config############### broken_sasl_auth_clients = yes smtpd_sasl_auth_enable = yes #smtpd_sasl_local_domain = $myhostname smtpd_sasl_security_options = noanonymous ###########smtpd related config############ smtpd_client_restrictions = permit_sasl_authenticated smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination #smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unknown_sender_domain, reject_non_fqdn_hostname , reject_non_fqdn_sender, reject_non_fqdn_recipient, reject_unknown_recipient_domain, reject_unauth_destination, reject_unauth_pipel ining, reject_invalid_hostname, check_recipient_maps ###### Maildrop config ######## maildrop_destination_recipient_limit = 1 virtual_transport = maildrop: 重启postfix,检查是否有语法错误 /etc/init.d/postfix restart SMTP身份认证 cd /etc/postfix openssl req -new -outform PEM -out smtpd.cert -newkey rsa:2048 -nodes -keyout smtpd.key -keyform PEM -days 365 -x509 apache2配置 注意:apache2的配置不通的版本有很大的区别,这里配置可能需要根据你使用的版本调整,这个使用是2.2版本 vim /etc/apache2/sites-enabled/mail
apt-get install maildrop
vi /etc/maildropmysql.config //创建一个文件
hostname localhost port 3306 database extmail dbuser extmail dbpw extmail dbtable mailbox default_uidnumber 1000 default_gidnumber 1000 uidnumber_field uidnumber gidnumber_field gidnumber uid_field username homedirectory_field concat(\'/home/vmail/\',homedir,\'/\') maildir_field concat(\'/home/vmail/\',maildir) quota_field quota mailstatus_field active
修改/etc/maildroprc
vi /etc/maildroprc
logfile "/var/log/maildrop.log"
vi /var/log/maildrop.log
chown vuser:vgroup /var/log/maildrop.log chmod 766 /var/log/maildrop.log
vi /etc/logrotate.d/maildrop
/var/log/maildrop.log { daily notifempty missingok rotate 5 compress create 766 www www sharedscripts }
vi /etc/postfix/master.cf,注释掉原来maildrop的配置内容并改为:
maildrop unix - n n - - pipe flags=DRhu user=www argv=maildrop -w 90 -d ${user}@${nexthop} ${recipient} ${user} ${extension} {nexthop} #flags前面必须空2格
由于maildrop不支持一次接收多个收件人,因此必须在/etc/postfix/main.cf增加参数,已经在前面main.cnf里面添加,就是Maildrop config里面的配置
创建vi /etc/quotawarnmsg,为邮箱空间超过配额时的警告邮件内容:
X-Comment: Rename/Copy this file to quotawarnmsg, and make appropriate changes X-Comment: See deliverquota man page for more information From: Mail Delivery System
/var/www/extsuite/extman/daemon/cmdserver -v -d
写入启机服务echo "/var/www/extsuite/extman/daemon/cmdserver -v -d" >>/etc/rc.local
完成部署登录http://mail.1k8k.com/extmail/ 前台,http://mail.1k8k.com/extman/后台
后台默认用户名 root@extmail.org 默认密码 extmail*123*,登录前台需要自己先添加一个用户
我们在微信上24小时期待你的声音
解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流