邮件服务器周边

邮件列表

mailman的安装

  1. 下载mailman

    [root@linuxas3 src]# wget http://ftp.gnu.org/gnu/mailman/mailman-2.1.5.tgz
    [root@linuxas3 src]# tar zxvf mailman-2.1.5.tgz
    [root@linuxas3 src]# cd mailman-2.1.5
    [root@linuxas3 mailman-2.1.5]#
    			
  2. 编译、安装mailman

    建议把mailman安装在/home目录下。

    [root@linuxas3 mailman-2.1.5]# groupadd mailman
    [root@linuxas3 mailman-2.1.5]# useradd -g "mailman" -c "Mailman User" mailman 
    [root@linuxas3 mailman-2.1.5]# chmod a+rx,g+ws /home/mailman
    [root@linuxas3 mailman-2.1.5]# id mailman
    uid=502(mailman) gid=502 groups=502
    
    [root@linuxas3 mailman-2.1.5]# ./configure --prefix=/home/mailman \
    --with-mail-gid=nobody  --with-cgi-gid=postfix \
    --with-username=mailman --with-groupname=mailman \
    --with-mailhost=lists.9812.net --with-urlhost=lists.9812.net (不要加http://)
    
    configuration completed at Tue May 11 17:09:11 HKT 2004
    提示上面信息表示成功
    [root@linuxas3 mailman-2.1.5]# make
    [root@linuxas3 mailman-2.1.5]# make install
    [root@linuxas3 mailman-2.1.5]# cd /home/mailman/
    			

    --with-mailhost 邮件服务器主机,设为mail.example.org 你的邮件列表即[email protected],一般设为example.org较好,也有一些用户设为lists.example.org

    如果安装在其它目录,请接操作下面几个步骤:

    [root@linuxas3 mailman-2.1.5]# mkdir /usr/local/mailman
    [root@linuxas3 mailman-2.1.5]# chown mailman.mailman /usr/local/mailman
    [root@linuxas3 mailman-2.1.5]# chmod 02775 /usr/local/mailman
    			

    安装完后检查权限:

    [root@linuxas3 mailman]# /home/mailman/bin/check_perms
    			

    检查权限是否正常,如果得到"No Problem found",恭喜你,安装这一部分成功结束了。

    如果有问题可以使用-f 修复

    [root@linuxas3 mailman]# /home/mailman/bin/check_perms -f
    			

    修复再检查一次

    [root@linuxas3 mailman-2.1.5]# /home/mailman/bin/check_perms
    No problems found
    [root@linuxas3 mailman-2.1.5]#
    			
  3. 配置mailman

    [root@linuxas3 mailman-2.1.5]# cd /home/mailman/
    加上mailman的cron:
    [root@linuxas3 mailman]# cd cron/
    [root@linuxas3 cron]# crontab -u mailman crontab.in
    [root@linuxas3 cron]# cd ..
    把mailman加到启动组里:
    [root@linuxas3 mailman]# cp scripts/mailman /etc/init.d/
    [root@linuxas3 mailman]# chkconfig mailman on
    [root@linuxas3 mailman]#
    			

    修改/home/mailman/Mailman/mm_cfg.py,加上:

    ###############################################
    # Here's where we get the distributed defaults.
    
    from Defaults import *
    
    ##################################################
    # Put YOUR site-specific settings below this line.
    MTA='Postfix'
    DEFAULT_HOST_NAME = 'lists.test.org'
    DEFAULT_EMAIL_HOST = 'lists.test.org'
    DEFAULT_URL = 'http://lists.test.org'
    DEFAULT_URL_HOST = 'lists.test.org'
    DEFAULT_SERVER_LANGUAGE = 'zh_CN'
    POSTFIX_STYLE_VIRTUAL_DOMAINS = ['lists.test.org', 'test.org']
    add_virtualhost(DEFAULT_URL_HOST, DEFAULT_EMAIL_HOST)
    			

    lists.test.org改为你的域名,如果安装时指定--with-mailhost=lists.9812.net --with-urlhost=lists.9812.net不需要设置下面选项,删除它

    DEFAULT_HOST_NAME = 'lists.test.org'
    DEFAULT_EMAIL_HOST = 'lists.test.org'
    DEFAULT_URL = 'http://lists.test.org'
    DEFAULT_URL_HOST = 'lists.test.org'
    			
  4. postfix相关配置

    还需要修改postfix的配置文件才能使mailman工作正常,修改main.cf,加上:

    [root@linuxas3 mailman]# vi /etc/postfix/main.cf
    owner_request_special = no
    recipient_delimiter = +
    unknown_local_recipient_reject_code = 550
    			

    修改alias_maps和virtual_maps为:

    [root@linuxas3 postfix]# vi main.cf
    myorigin = lists.test.org
    
    virtual_maps = hash:/home/mailman/data/virtual-mailman, mysql:/etc/postfix/mysql-virtual.cf
    virtual_mailbox_maps = hash:/data/mailman/data/virtual-mailman,  mysql:/etc/postfix/mysql-virtual-maps.cf
    
    alias_maps = hash:/etc/aliases, hash:/home/mailman/data/aliases,mysql:/etc/postfix/mysql-aliases.cf
    alias_database = hash:/etc/aliases, hash:/home/mailman/data/aliases
    
    			

    Example 1. main.cf

    #======= BASE ==============
    mail_spool_directory = /var/mail/
    #myhostname = mail.example.net
    myhostname = mail.gomi.com.hk
    #mydomain = example.net
    mydomain = gomi.com.hk
    #myorigin = $mydomain
    myorigin = as3.9812.net
    #home_mailbox=./Maildir/
    mydestination = $myhostname, $mydomain, $transport_maps
    local_recipient_maps =
    #mynetworks = 127.0.0.1, 192.168.0.0/24
    
    #======= Maildrop  =============
    mailbox_command= /usr/lib/courier-imap/bin/deliverquota -w 90 ~/Maildir
    #mailbox_command = /usr/local/courier/bin/maildrop
    #mailbox_command = /usr/bin/maildrop -d "$USER" -f "$SENDER" "$EXTENSION"
    #mailbox_transport = maildrop
    #fallback_transport = maildrop
    local_destination_concurrency_limit = 1
    
    #======= MYSQL =============
    virtual_mailbox_base = /var/mail
    transport_maps = mysql:/etc/postfix/mysql-transport.cf
    alias_maps = hash:/etc/aliases, hash:/home/mailman/data/aliases, mysql:/etc/postfix/mysql-aliases.cf
    alias_database = hash:/etc/aliases, hash:/home/mailman/data/aliases
    virtual_alias_maps = hash:/home/mailman/data/virtual-mailman, mysql:/etc/postfix/mysql-aliases.cf
    virtual_maps = hash:/home/mailman/data/virtual-mailman, mysql:/etc/postfix/mysql-virtual.cf
    #virtual_maps = mysql:/etc/postfix/mysql_aliases.cf
    #virtual_mailbox_maps = mysql:/etc/postfix/mysql_virtual.cf
    virtual_mailbox_maps = hash:/home/mailman/data/virtual-mailman, mysql:/etc/postfix/mysql-virtual-maps.cf
    #virtual_uid_maps = mysql:/etc/postfix/mysql-virtual-uid.cf
    #virtual_gid_maps = mysql:/etc/postfix/mysql-virtual-gid.cf
    virtual_uid_maps = static:1000
    virtual_gid_maps = static:1000
    #======= Quota ============
    #50MB
    virtual_mailbox_limit = 500000000
    #5MB
    message_size_limit = 50000000
    virtual_mailbox_limit_inbox = no
    virtual_mailbox_limit_maps = mysql:/etc/postfix/mysql-quota.cf
    virtual_mailbox_limit_override = yes
    virtual_maildir_extended = yes
    virtual_create_maildirsize = yes
    #====== SASL ================
    smtpd_sasl_auth_enable = yes
    smtpd_sasl_security_options = noanonymous
    broken_sasl_auth_clients = yes
    smtpd_recipient_restrictions = permit_sasl_authenticated permit_auth_destination reject
    #smtpd_sasl_local_domain = $mydomain
    smtpd_client_restrictions = permit_sasl_authenticated
    #============ Amavis ================
    soft_bounce=yes
    content_filter = smtp-amavis:[127.0.0.1]:10024
    
    #============ Mailman ================
    #alias_maps = hash:/etc/postfix/aliases,hash:/home/mailman/data/aliases
    #virtual_alias_maps = hash:/etc/postfix/virtual,hash:/home/mailman/data/virtual-mailman
    #virtual_maps = hash:/etc/postfix/virtual, regexp:/etc/postfix/virtual_regexp
    owner_request_special = no
    recipient_delimiter = +
    #unknown_local_recipient_reject_code = 550
    [root@linuxas3 postfix]#
    			

    然后在postfix_transport表里添加一个记录:

    insert into postfix_transport set domain='lists.test.org',transport='local:';