postfix 做为群发服务器的设置:只发不收

Postfix on a null client

A null client is a machine that can only send mail. It receives nomail from the network, and it does not deliver any mail locally. Anull client typically uses POP, IMAP or NFS for mailbox access.

In this example we assume that the Internet domain name is"example.com" and that the machine is named "nullclient.example.com".As usual, the examples show only parameters that are not left attheir default settings.

1 /etc/postfix/main.cf:

在此配置文件中增加以下参数设置

2 myorigin = $mydomain

这上面的配置感觉用不上,个人去掉

3 relayhost = $mydomain  

上面这个配置会让所有的邮件向mydomain中发送,去掉,或许我没有完全理解

4 inet_interfaces = loopback-only

5 local_transport = error:local delivery is disabled6

 

 

7 /etc/postfix/master.cf:

8 Comment out the local delivery agent entry:注释掉所有本地投递的进程

就是把这个进程注释掉

#local unix - n n - - local

 

Translation:

  • Line 2: Send mail as "user@example.com" (instead of"user@nullclient.example.com"), so that nothing ever has a reasonto send mail to "user@nullclient.example.com".

  • Line 3: Forward all mail to the mail server that isresponsible for the "example.com" domain. This prevents mail fromgetting stuck on the null client if it is turned off while someremote destination is unreachable.

  • Line 4: Do not accept mail from the network.

  • Lines 5-8: Disable local mail delivery. All mail goes tothe mail server as specified in line 3.

 

You can then test to make sure everything is working by sending an email to an account that has been setup from where you setup Postfix as a null client (i.e. mail user@example.com ). Also make sure you have a root@example.com alias setup on your main mail server.

 

配合上面的

目前的只用于发送的配置main.cf

 

#--------安装配置参数------------
alias_maps = hash:/etc/aliases
#postfix可运行程序
command_directory = /usr/sbin
#配置路径
config_directory = /etc/postfix
#守护目录
daemon_directory = /usr/lib/postfix
#数据目录
data_directory = /var/lib/postfix
#mail用户
mail_owner = postfix
mailq_path = /usr/bin/mailq
manpage_directory = /usr/local/man
newaliases_path = /usr/bin/newaliases
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc
sample_directory = /usr/share/doc/postfix/examples
sendmail_path = /usr/sbin/sendmail
setgid_group = postdrop
#------------------------默认参数修改--------------
#弹回:Specify 0 when mail delivery should be tried only once
bounce_queue_lifetime = 0
#同域并发
default_destination_recipient_limit = 1
#只接收环回信件
inet_interfaces = loopback-only
inet_protocols = ipv4
#初次尝试同域发送量
initial_destination_concurrency = 1
#不允许本地投递
local_transport = error:local delivery is disabled
#队列存活期:Specify 0 when mail delivery should be tried only once.
maximal_queue_lifetime = 0
#域名
mydomain = myhrd.cn
#主机名
myhostname = chrd-mail
#发送同域间隔
smtp_destination_rate_delay = 30s
#smtp交互规则
smtpd_recipient_restrictions = reject_unknown_recipient_domain,permit_mynetworks,reject_unauth_destination

 

 

/etc/rsyslog.d/50-default.conf配置mail

 


#
# Logging for the mail system.  Split it up so that
# it is easy to write scripts to parse these files.
#
#only log smtpd domain error
$template mailOkFail,"%timegenerated% %msg%\n"

#下面二个用于文件名的设置没找出能在"半路"自动生成的方式,它得是在初始化时生成
$template bounlog,"/var/log/mail.smtp.bounced.%$month%_%$day%"
$template deferlog,"/var/log/mail.smtp.deferred.%$month%_%$day%"

if ($syslogtag startswith 'postfix/smtpd[') and ($msg contains 'Domain not found') then /var/log/mail.smtpd.domain.err;mailOkFail

#send ok
if ($syslogtag startswith 'postfix/smtp[') and ($msg contains 'status=sent') then /var/log/mail.smtp.sent;mailOkFail

#bound status=bounced
if ($syslogtag startswith 'postfix/smtp[') and ($msg contains 'status=bounced') and not ($msg contains 'loops back to myself') then /var/log/mail.smtp.boun;mailOkFail

#deferred
if ($syslogtag startswith 'postfix/smtp[') and ($msg contains 'status=deferred') and not ($msg contains ':>') loops back to myself') then /var/log/mail.smtp.def;mailOkFail

#mail.debug            -/var/log/mail.debug
mail.info            -/var/log/mail.info
#mail.notice            -/var/log/mail.notice
#mail.warning            -/var/log/mail.warning
#mail.warn            -/var/log/mail.warn
#mail.error            -/var/log/mail.error
#mail.err            /var/log/mail.err
#mail.crit            -/var/log/mail.crit
#mail.alert            -/var/log/mail.alert
#mail.emerg            -/var/log/mail.emerg
#mail.panic            -/var/log/mail.panic
#

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值