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

postfix配置&使用的更多相关文章

  1. linux邮件服务器postfix配置实例

    linux邮件服务器postfix配置实例(超级详细!!!) 2013-03-13 13:30:21 标签:邮件服务器 linux 1. 系统安装:1)centos4.3 选上MAIL组件里的全部.2 ...

  2. postfix配置积累(不断的积累)

    postfix 配置 1.mail_name 默认是Postfix.在收件人信头可以查看,如果不想让别人知道你是用postfix发的,则可以改成其它名字,如:postconf -e mail_name ...

  3. Postfix配置Q&A

    原文地址:http://space.doit.com.cn/51460/viewspace-4943.html 在配置Postfix中遇到的一些问题及相关的解决方法,希望在遇到相同的问题时能起参考的作 ...

  4. postfix配置spf认证和dkim认证

    1.为邮箱域名添加spf认证: 登录域名解析控制台添加txt记录: v=spf1 include:spf1.domain.com ~all spf1.domain.com  A记录解析到你的固定IP ...

  5. Linux postfix配置方法

    第七题 配置邮件服务器 postfix学习网站:https://blog.csdn.net/mycms5/article/details/78773308  system1和systemc2分别执行 ...

  6. 烂泥:Postfix邮件服务器搭建之软件安装与配置

    本文由ilanniweb提供友情赞助,首发于烂泥行天下 想要获得更多的文章,可以关注我的微信ilanniweb Postfix邮件服务器的搭建需要使用到几个软件,分别是cyrus-sasl.postf ...

  7. CentOS6.5_64位系统下安装配置postfix邮件系统 启用并配置SMTP在第三方上边使用发送邮件

    一前言 本来使用qq邮箱发送邮件,然后借助sendEmail来发送邮件告警,但是有每天的200封限制,很是不爽,于是想到来自己搭建邮件服务器来解决这个问题,关于使用sendEmail来借助qq邮箱来发 ...

  8. Linux学习19-gitlab配置邮箱postfix(新用户激活邮件)

    前言 gitlab新增新用户有两种方式,第一种可以用户主动注册(自己设置密码):第二种也可以通过root管理员用户直接添加用户,发个邮件到用户的邮箱里,收到邮件后激活. 如果是第二种方式添加新用户的话 ...

  9. Linux中Postfix邮件安装配置(二)

    本套邮件系统的搭建,从如何发邮件到收邮件到认证到虚拟用户虚拟域以及反病毒和反垃圾邮件等都有详细的介绍.在搭建过程中必须的参数解释以及原理都有告诉,这样才能更好地理解邮件系统. 卸载自带postfix ...

随机推荐

  1. JS 最简单数组去重

    ,,,,])) // 再把set转变成array console.log(newArr) // [1,2,3,4]

  2. Hadoop学习------Hadoop安装方式之(三):分布式部署

    这里为了方便直接将单机部署过的虚拟机直接克隆,当然也可以不这样做,一个个手工部署. 创建完整克隆——>下一步——>安装位置.等待一段时间即可. 我这边用了三台虚拟机,分别起名master, ...

  3. 运维shell全部语法进阶

    Linux运维之shell脚本进阶篇 一.if语句的使用 1)语法规则 1 2 3 4 5 6 7 8 9 if [条件]     then         指令 fi 或 if [条件];then ...

  4. web页面空白,无任何显示

    解决前: 解决后: 原因:HTML代码有误,没有关闭script标签. 解决方法:加</script>

  5. Python学习第七课

    Python学习第七课 'Alex' "Alex"print('hello'*5) #重复输出字符串 print('hellowold'[2:]) #类似于切片操作:会取出 llo ...

  6. EM 算法最好的解释

    https://wenku.baidu.com/view/fcb6a52bf5335a8102d220e3.html

  7. redis服务问题解决办法

    Redis是一个开源的使用ANSI C语言编写.支持网络.可基于内存亦可持久化的日志型.Key-Value数据库,并提供多种语言的API.ps aux|grep redis部署虚拟机失败,代码中添加任 ...

  8. Springboot框架,实现请求数据解密,响应数据加密的功能。

    一.简要说明: 在做这个功能的时候,参考了很多文章,也试了用过滤器解决.但总体来说还是很麻烦,所以换了另一种解决方案.直接实现RequestBodyAdvice和ResponseBodyAdvice两 ...

  9. 作业二:构建swap函数

    一.swap代码 #include<stdio.h> int main() //主函数部分 { void swap(int *m,int *n); int a,b; int *p1,*p2 ...

  10. 关于使用git上传远程仓库的两种情况(新项目与老项目)

    具体的git配置与github仓库ssh配置在这里就不再赘述,本次只讲自己之前遇到的两个内容 1.还没有项目,将远程仓库clone下来直接在里边写项目. 2.已有项目,将已有的项目直接添加到建立好的远 ...