-o smtp_tls_note_starttls_offer=no -o disable_dns_lookups=yes -o max_use=20
说明,请注意在maxproc栏内的数值 2 必须要与/etc/amavisd.conf内的$max_servers设定一致。
有关各选项的详细解释请参阅Amavisd-new的文档(vi /usr/share/doc/amavisd-new-2.8.0/README.postfix)。 然后我们定义一个专用的服务把邮件重新注入Postfix。我们为此在/etc/postfix/master.cf内加入一个在localhost(127.0.0.1)的tcp 10025端口(/etc/amavisd.conf的预设值)上监听的smtp服务: # ========================================================================== # # service type private unpriv chroot wakeup maxproc command + args # # (yes) (yes) (yes) (never) (100)
# # ========================================================================== 127.0.0.1:10025 inet n - n - - smtpd -o content_filter=
-o smtpd_delay_reject=no
-o smtpd_client_restrictions=permit_mynetworks,reject -o smtpd_helo_restrictions= -o smtpd_sender_restrictions=
-o smtpd_recipient_restrictions=permit_mynetworks,reject -o smtpd_data_restrictions=reject_unauth_pipelining -o smtpd_end_of_data_restrictions= -o smtpd_restriction_classes= -o mynetworks=127.0.0.0/8 -o smtpd_error_sleep_time=0 -o smtpd_soft_error_limit=1001 -o smtpd_hard_error_limit=1000
-o smtpd_client_connection_count_limit=0 -o smtpd_client_connection_rate_limit=0 -o
receive_override_options=no_header_body_checks,no_unknown_recipient_checks,no_milters,no_address_mappings
-o local_header_rewrite_clients= -o smtpd_milters=
-o local_recipient_maps=
注意,以上两项首行前面一定不能有空格,否则会出错!!! (2).修改/etc/postfix/main.cf加入以下设定来启用邮件过滤 [root@mail ~]# vi /etc/postfix/main.cf #filter mail
content_filter = amavisfeed:[127.0.0.1]:10024 (3).重启postfix服务
7.启动clamd及amavisd服务: service clamd restart service amavisd restart
十三、安装并配置managesieve插件
说明,managesieve插件实现邮件过滤和Vacation功能
1.在Doevecot2.0之后的版本,如果需要做邮件过滤的功能需要dovecot-pigeonhole扩展包的支持 [root@mail ~]# yum install -y dovecot-pigeonhole 2.配置dovecot配置文件
[root@mail ~]# vi /etc/dovecot/dovecot.conf protocols = imap pop3 sieve
[root@mail ~]# vi /etc/dovecot/conf.d/15-lda.conf mail_plugins = quota sieve
3.重新启动dovecot
[root@mail ~]# service dovecot restart
4. 查看Dovecot监听4190端口
[root@mail ~]# netstat -ntulp | grep 4190
tcp 0 0 0.0.0.0:4190 0.0.0.0:* LISTEN 17998/dovecot [root@mail ~]#
5.managesieve配置文件修改,将模板复制成config.inc.php,做如下修改 [root@mail ~]# cd /var/www/html/webmail/plugins/managesieve/ [root@mail managesieve]# ls
Changelog config.inc.php.dist lib localization managesieve.js managesieve.php package.xml skins tests
[root@mail managesieve]# cp config.inc.php.dist config.inc.php [root@mail managesieve]# vi config.inc.php #修改端口为
$rcmail_config['managesieve_port'] = 4190;
6.在主配置文件中使插件生效 1 2
[root@mail ~]# vi /var/www/html/webmail/config/main.inc.php $rcmail_config['plugins'] = array('managesieve');
十四,配置使用修改密码插件
roundcube自带修改密码插件但是没有使用
使用插件的方法是修改config/main.inc.php文件。里面
$rcmail_config['plugins'] = array('managesieve','password');就是启用插件
插件放在plugins目录下,插件目录的名字不能打错,一般和插件内的php文件名字相同
修改password下的config.inc.php文件,因为我是使用doveadm pw加密的。而doveadm pw的命令地址已经更换,所以需要指定该命令地址
$rcmail_config['password_driver'] = 'sql'; 使用sql来修改密码 $rcmail_config['password_confirm_current'] = true;
$rcmail_config['password_db_dsn'] = 'mysql://postfix:postfixpassword@localhost/postfix'; 这里是指的修改的数据库的类型,用户名,用户名密码 和数据库表
$rcmail_config['password_query'] = 'UPDATE mailbox SET password=%D WHERE username=%u LIMIT 1'; 这是修改数据库的命令。mailbox是webmail的表名, %D指的是使用dovecot方式加密
$rcmail_config['password_dovecotpw'] = '/usr/bin/doveadm pw'; 这是指定加密命令的位置,如果没有这一
句会提示密码无法加密 其他基本是默认配置
使用虚拟邮:#mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain, 十五,导入通讯录csv文件。
先导出一个vcard文件,然后转换成csv。将;全部换成,
保留表头First Name,Display Name,Nickname,Primary Email 就可以。不要用excel去编辑,否则导入以后中文是乱码,因为excel不是用utf8字符集 十六,一些其他的配置
1.web页面里默认可以允许随便编辑身份,并且能发送。 更改config/main.inc.php的$rcmail_config['identities_level'] // Set identities access level:
// 0 - many identities with possibility to edit all params
// 1 - many identities with possibility to edit all params but not email address // 2 - one identity with possibility to edit all params
// 3 - one identity with possibility to edit all params but not email address // 4 - one identity with possibility to edit only signature $rcmail_config['identities_level'] = 3; 默认是0,改为3
基本注意的就是权限,和命令的位置问题 2.Postfix对特定邮件地址限制发件人的设置
因公司需要将all@domain.com地址设置权限,只允许指定的人员可以给全体员工发邮件,做下笔记。 1. 修改/etc/postfix/main.cf 添加:
smtpd_restriction_classes = vip_rec
vip_rec = check_sender_access hash:/etc/postfix/local_domains,reject
修改smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated,…………..加上check_recipient_access hash:/etc/postfix/local_recipients 即:
smtpd_recipient_restrictions = check_recipient_access hash:/etc/postfix/local_recipients, permit_mynetworks, permit_sasl_authenticated,......(写在permit_mynetworks前面) 2. 创建local_recipients文件,设置收件人策略 #vi /etc/postfix/local_recipients 文件内容如下:
all@domain.com vip_rec 然后
#postmap local_recipients 生成hash
3.创建local_domains文件,设置发件人规则 #vi /etc/postfix/local_domains 文件内容如下: ceo@domain.com ok cto@domain.com ok 然后
#postmap local_domains 4.Reload postfix
#/etc/init.d/postfix reload
测试了一下,使用不在local_domains文件中的邮箱对all@domain.com发信会被拒绝,提示:554 5.7.1 Recipient address rejected: Access denied。