搭建环境:

关于PostFix是什么以及邮件服务器接受发送邮件流程网上有很多文章,这里就不再写了,这里只记录如何搭建邮件服务器,使用PostFix接受发送邮件

CentOS6.8 32位,postfix-2.6.6

配置工具:

yum install postfix

postfix主要配置文件在/etc/postfix/main.cf中

修改后内容如下(yuming.com改为自己的域名)

queue_directory = /var/spool/postfix
command_directory = /usr/sbin
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
mail_owner = postfix
myhostname = localhost
mydomain = yuming.com
myorigin = $mydomain
inet_interfaces = all
inet_protocols = ipv4
mydestination = $myhostname, localhost.$mydomain, localhost, yuming.com
unknown_local_recipient_reject_code = 550
mynetworks_style = host
mynetworks = 127.0.0.0/8,192.168.100.0/24,hash:/etc/postfix/access
relay_domains = $mydestination
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
debug_peer_level = 2
debugger_command =
PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
ddd $daemon_directory/$process_name $process_id & sleep 5
sendmail_path = /usr/sbin/sendmail.postfix
newaliases_path = /usr/bin/newaliases.postfix
mailq_path = /usr/bin/mailq.postfix
setgid_group = postdrop
html_directory = no
manpage_directory = /usr/share/man
sample_directory = /usr/share/doc/postfix-2.6.6/samples
readme_directory = /usr/share/doc/postfix-2.6.6/README_FILES

邮件别名配置文件

在 /etc/aliases 文件中,你会发现有如下的文件内容

bin:            root
daemon: root
adm: root
lp: root
sync: root
shutdown: root
halt: root
mail: root
news: root
uucp: root

文件中的意思是,如果有邮件发送到左边用户的邮箱内,则会由右边的邮件帐号来接收

启动服务

postmap hash:/etc/postfix/access
postalias hash:/etc/aliases
检查是否有错误
/etc/init.d/postfix check
启动服务
service postfix start
或者
service postfix restart
查看是否成功
netstat -tlunp | grep ':25'

开放端口

开放25端口,不然发送不出去

iptables -A INPUT -p tcp --dport 25 -j ACCEPT
iptables -A OUTPUT -p tcp --sport 25 -j ACCEPT

测试发送邮件

yum install mail  #安装邮件客户端
echo hello > mail.txt #将需要发送的邮件内容写入一个文件
mail -s "Hello" reyzal@163.com < mail.txt #发送到reyzal@163.com邮箱

测试接收邮件

使用mail即可查看邮件

结束

CentOS 使用PostFix搭建邮件服务器的更多相关文章

  1. CentOS利用postfix搭建邮件服务器

    之前我用nodemailer通过163邮箱来发送邮件,不过没过几天就一直ETIMEDOUT,不知道什么原因,想着还是自己搭一个来发邮件可能靠谱点(flag?) 安装postfix CentOS 7 自 ...

  2. Linux中用postfix搭建邮件服务器实战详解

    Linux中用postfix搭建邮件服务器实战详解 postfix是Wietse Venema在IBM的GPL协议之下开发的MTA(邮件传输代理)软件.Postfix试图更快.更容易管理.更安全,同时 ...

  3. 转-阿里云CentOS Linux服务器上用postfix搭建邮件服务器

    http://www.cnblogs.com/dudu/archive/2012/12/12/linux-postfix-mailserver.html 注:本文的邮件服务器只用于发送邮件,也就是ST ...

  4. 阿里云CentOS Linux服务器上搭建邮件服务器遇到的问题

    参考文章: 阿里云CentOS Linux服务器上用postfix搭建邮件服务器 Linux系统下邮件服务器的搭建(Postfix+Dovecot) 本来想自己搭建邮件服务器,但是看到一篇资料表示阿里 ...

  5. Postfix+Dovecot+MySQL搭建邮件服务器

    网上有很多使用Postfix搭建邮件服务器的文章,但目前貌似没有看到较为完整的一篇.本例将尝试在Ubuntu系统中使用Postfix+Dovecot+MySQL搭建邮件服务器. 说到邮件服务器,网上有 ...

  6. 搭建邮件服务器,使用Postfix与Dovecot收发电子邮件

    小知识: 我们为什么要搭建邮件服务器呢?有时候我们处于一个局域网内,不能及时的分享各自的研究成果,迫切的需要一种能够借助于网络且建立在计算机之间的传输数据的方法.所以我们需要搭建邮件服务器,这样的话既 ...

  7. centos6.8 搭建postfix/dovecot邮件服务器

    postfix/dovecot邮件服务器 安装配置参考链接  http://www.cnblogs.com/jkklearn/p/7280045.html (domain 为自己域名 xxx.com) ...

  8. Windows Server 2003搭建邮件服务器

    Windows Server 2003搭建邮件服务器 由于Windows Server 2003默认是没有安装我们搭建邮件服务器所需要的POP3和SMTP服务的,因此需要我们自己来安装.方法如下: 1 ...

  9. CentOS 6.4 搭建git 服务器

    CentOS 6.4 搭建git 服务器 (2013-11-22 19:04:09)转载▼ 标签: it 分类: Linux 此文件是依据markdown所编写,更好效果参见本人github的文档ht ...

随机推荐

  1. Mysql优化实践(分页优化)

    当你和别人都能实现一个某个功能,这时候区分你们能力的不是谁干活多少,而是谁能写出效率更高的代码.比如显示一个订单列表它不仅仅是写一条SELECT SQL那么简单,我们还需要很清楚的知道这条SQL他大概 ...

  2. Angular.js数据绑定时自动转义html标签及内容

    angularJS在进行数据绑定时默认是以字符串的形式数据,也就是对你数据中的html标签不进行转义照单全收,这样提高了安全性,防止html标签的注入攻击,但有时候需要,特别是从数据库读取带格式的文本 ...

  3. hdu 1026 Ignatius and the Princess I(BFS+优先队列)

    传送门: http://acm.hdu.edu.cn/showproblem.php?pid=1026 Ignatius and the Princess I Time Limit: 2000/100 ...

  4. File常见操作函数

    String Name = File.getName();  //获得文件或文件夹的名称: String parentPath = File.getParent();  //获得文件或文件夹的父目录 ...

  5. .net core运行环境搭建 linux + windows

    ---------------------------------------linux------------------------------------------------- 一.添加do ...

  6. CentOS7利用本地yum源配置NBD

    一:CentOS7.0创建本地YUM源 (物理机:直接将刻录的CentOS7光盘利用光驱插入物理机上) (虚拟机: CD/DVD>>连接本地ISO) 针对物理机192.168.9.112进 ...

  7. iOS:动画(18-10-15更)

    目录 1.UIView Animation 1-1.UIView Animation(基本使用) 1-2.UIView Animation(转场动画) 2.CATransaction(Layer版的U ...

  8. Head First Java学习笔记

    1.基本概念 1.1.工作方式 源代码(.java)---编译器(执行javac程序)---产生字节码(.class与平台无关)---JAVA虚拟机(JVM,读取与执行字节码) 1.2.汇编语言是对基 ...

  9. Jewels and Stones

    题目如下 You're given strings J representing the types of stones that are jewels, and S representing the ...

  10. QT 防止FTP 上传软件在断连处 Crash

    前段时间发现项目中的上传FTP软件有可能会在从服务器申请断连时Crash, 所以加了一个Timer. 由于项目代码行数过大, 此处上传部分代码片段. timeoutTimer = new QTimer ...