首页 技术 正文
技术 2022年11月23日
0 收藏 937 点赞 4,313 浏览 2635 个字
myorigin = $mydomain  #以“user@example.com”(而不是“user@hostname.example.com”)发送邮件,
#这样就没有理由将邮件发送到“user@hostname.example.com”。
# 一般使用domain name,而不使用hostname
relayhost = $mydomain #将所有邮件转发到负责“example.com”域的邮件服务器。
#如果在某些远程目标无法访问时关闭邮件,则可以防止邮件卡在空客户端上。
#如果您的“example.com”域没有MX记录,请在此处指定真实的主机名。
# The relayhost parameter specifies the default host to send mail to
# when no entry is matched in the optional transport(5) table. When
# no relayhost is given, mail is routed directly to the destination.
# transport table (转发规则表) > relayhost > $mydestination
inet_interfaces = loopback-only #不接受来自网络的邮件。
# The inet_interfaces parameter specifies the network interface
# addresses that this mail system receives mail on.指定接受邮件的网卡地址
mynetworks = 127.0.0.0/ 10.0.0.0/ #指定可信网络。
# The mynetworks parameter specifies the list of "trusted" SMTP clients that have more privileges than "strangers".
relay_domains = #此主机不会从不受信任的网络中继邮件。
#The relay_domains parameter restricts what destinations this system will relay mail to.# 指定收件人的域名,也就是允许中继的域名
mydestination = #禁用本地邮件传递。所有邮件都按照第【relay_domains】的说明进入邮件服务器。
         # The mydestination parameter specifies the list of domains that this
# machine considers itself the final destination for.# 指定本地邮件域

例子1:

mydomain = qq.com#inet_interfaces = localhost
inet_interfaces = all # 所有网卡都接受邮件mynetworks_style = subnet # 通过子网形式显示信任网络mynetworks = 168.100.189.0/, 127.0.0.0/8 # 指定信任网络#relay_domains = $mydestination
relay_domains =#relayhost = [gateway.my.domain]
relayhost = [gateway.my.domain]

例子2:

mydomain = qq.com#inet_interfaces = localhost
inet_interfaces = all#mynetworks_style = subnet#mynetworks = 168.100.189.0/, 127.0.0.0/#relay_domains = $mydestination
relay_domains = qq1.com,qq2.com... # 只允许中继这些域#relayhost = [gateway.my.domain]
relayhost = [gateway.my.domain]

# 强制发送队列中的邮件
postfix flush
postqueue -f

# 查看邮件队列大小
mailq | wc -l
postqueue -p |wc -l

# 查看队列中的邮件
mailq
postqueue -p

# 查看特定邮件内容
postcat -q Queue_ID

# 按邮件ID删除队列中的邮件
postsuper -d Queue_ID

# 暂缓发送队列中的邮件
postsuper -h Queue_ID
postsuper -h ALL deferred
# 解除暂缓发送
postsuper -H Queue_ID
postsuper -H ALL deferred

# 重新加入队列
postsuper -r Queue_ID
postsuper -r ALL

# 删除队列中的问题邮件
postsuper -d ALL deferred
find /var/spool/postfix/deferred -type f -exec rm -vf {} \;

# 删除3天以内未发出的邮件
find /var/spool/postfix/deferred -type f -mtime +3 -exec rm -f {} \;

# 删除超过5天的问题邮件的退信记录
find /var/spool/postfix/defer -type f -mtime +5 -exec rm -f {} \;

# 列出所有问题邮件
find /var/spool/postfix/deferred -type f -exec ls -l –time-style=+%Y-%m-%d_%H:%M:%S {} \;

# 复杂用法:利用grep得到特定的邮件ID,再删除,如:(待确认????????????????)
mailq | grep -B 1 “Hotconcerts@gmail.com” | cut -f 1 -d ! > deletionIDs” $ cat deletionIDs | postsuper -d –

postfix有四种不同的邮件队列,并且由队列管理进程统一进行管理:
  1. maildrop:本地邮件放置在maildrop中,同时也被拷贝到incoming中。
  2. incoming:放置正在到达或队列管理进程尚未发现的邮件。
  3. active:放置队列管理进程已经打开了并正准备投递的邮件,该队列有长度的限制。
  4. deferred:放置不能被投递的邮件。

## 常用管理命令
# 重新读取postfix配置文件
postfix reload
# 检查配置
postfix check

# 显示配置内容,在mail.cf配置过的
postconf -n
# 所有配置内容,包括默认配置内容
postconf

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:8,958
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,482
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,328
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,111
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,743
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,777