初始功能开启:

以下用到的文件都在/etc/postfix下
1.# vi main.cf
添加下面几行:
#设置只能555@bobo365.com 给allstaff@bobo365.com 发邮件
smtpd_restriction_classes = local_only
local_only = check_sender_access hash:/etc/postfix/local_sender,

reject
smtpd_sender_restrictions = check_recipient_access

hash:/etc/postfix/local_recipient
2.#vi local_sender
加入允许群发到all的邮件列表:
555@bobo365.com   OK
333@bobo365.com   OK
如果允许本域所有用户可以群发到all,则只添加
bobo365.com  OK
即可。
3.# vi local_recipient
  添加群账号:
allstaff@bobo365.com    local_only
4.建立local_recipient和local_sender的hash表
#  postmap hash:/etc/postfix/local_sender
#  postmap hash:/etc/postfix/local_recipient 
在/etc/postfix目录下生成2个db文件:
local_recipient.db和local_sender.db
5.重载Postfix
# /etc/init.d/postfix reload
6.测试:只有在local_sender里的用户才能给allstaff@bobo365.com群发,其他

不受影响。

——————————————————————–

后期增加:

1.#vi /etc/postfix/local_sender
加入允许群发到all的邮件列表:
king@bobo365.com   OK

2.更新数据库

#  postmap hash:/etc/postfix/local_sender

3.重启Postfix
# /etc/init.d/postfix restart

 

 

升级篇:(支持多邮件列表)

 

main.cf

 

smtpd_restriction_classes = allow_to_all,allow_to_vm,allow_to_idc
allow_to_all = check_sender_access hash:/etc/postfix/allow_to_all, reject
allow_to_vm = check_sender_access hash:/etc/postfix/allow_to_vm, reject
allow_to_idc = check_sender_access hash:/etc/postfix/allow_to_idc, reject
smtpd_sender_restrictions =check_recipient_access hash:/etc/postfix/limit_sender_group

 
limit_sender_group

 

allstaff@bobo365.com allow_to_all
wm-all@bobo365.com  allow_to_vm
it-idc@bobo365.com  allow_to_idc

 
allow_to_all

 

fei@bobo365.com       ok
da@bobo365.com        ok


allow_to_vm

 

xu@bobo365.com       ok
xin@bobo365.com      ok

 

allow_to_idc

 

jin@bobo365.com  ok

 
生成三个db文件
postmap hash:/etc/postfix/limit_sender_group
postmap hash:/etc/postfix/allow_to_all
postmap hash:/etc/postfix/allow_to_vm                                    
postmap hash:/etc/postfix/allow_to_idc