搭建邮件服务器 Postfix + Dovecot (CentOS)
最近分配到一台ECS服务器,需要搭建一台邮件服务器。
查了一波资料选择了Postfix (smtp)和 Dovecot(pop3).
推荐教程:http://www.cnblogs.com/zlbeidou/p/3436332.html (我的是CentOS6.5 如果是Centos7.*的注意selinux,防止出现坑,ubuntu用此教程的话注意使用sudo指令,其他基本相同)
1:配置 DNS 服务器并添加邮件服务器 MX 记录. 并让 ISP 支持你的静态 IP 与域名. (局域网搭建跳过此步骤,服务器必须)
2:安装 Postfix
[root@server ~]# yum install postfix -y
配置 Postfix
打开 /etc/postfix/main.cf 更改如下配置:
## Line no - Uncomment and set your mail server FQDN ##
myhostname = server.cnblogs.com 你的主机名称(比我是mail.xxx.com,需要加到MX记录,优先级10) ## Line - Uncomment and Set domain name ##
mydomain = cnblogs.com 你的域名(比如我是xxx.com) ## Line - Uncomment ##
myorigin = $mydomain ## Line - Set ipv4 ##
inet_interfaces = all ## Line - Change to all ##
inet_protocols = all ## Line - Comment ## #mydestination = $myhostname, localhost.$mydomain, localhost, ## Line - Uncomment ##
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain ## Line - Uncomment and add IP range ##
mynetworks = 192.168.1.0/, 127.0.0.0/8(也可以不改) ## Line - Uncomment ##
home_mailbox = Maildir/ (邮件存放目录)
保存并退出, 重启 Postfix 服务:
[root@server ~]# /etc/init.d/postfix start
[root@server ~]# /etc/init.d/postfix status
master (pid ) is running...
[root@server ~]# chkconfig postfix on
测试 Postfix
通过 telnet 进行测试, 没有 telnet 可通过 yum 安装, 一下出现红色字体表示输入.
新建测试用户 fourone:
[root@server ~]# useradd fourone
[root@server ~]# passwd fourone
测试功能
[root@server ~]# telnet localhost smtp
Trying ::...
Connected to localhost.
Escape character is '^]'.
server.cnblogs.com ESMTP Postfix
ehlo localhost
-server.cnblogs.com
-PIPELINING
-SIZE
-VRFY
-ETRN
-ENHANCEDSTATUSCODES
-8BITMIME
DSN
mail from:<fourone>
2.1. Ok
rcpt to:<fourone>
2.1. Ok
data
End data with <CR><LF>.<CR><LF>
hello fourone
.
2.0. Ok: queued as 3E68E284C
quit
2.0. Bye
Connection closed by foreign host.
进入 fourone mail 目录检查邮件:
[root@server ~]# ls /home/fourone/Maildir/new/
.Vfd00I41ec0M251771.server.cnblogs.com
[root@server ~]# cat /home/fourone/Maildir/new/.Vfd00I41ec0M251771.server.cnblogs.com
Return-Path: <fourone@cnblogs.com>
X-Original-To: fourone
Delivered-To: fourone@cnblogs.com
Received: from localhost (localhost [IPv6:::])
by server.cnblogs.com (Postfix) with ESMTP id 3E68E284C
for <zl>; Wed, May :: + (IST)
Message-Id: <.3E68E284C@server.cnblogs.com>
Date: Wed, May :: + (IST)
From: fourone@cnblogs.com
To: undisclosed-recipients:;
hello fourone
3:安装 Dovecot
Dovecote 是一款开源 IMAP/POP3 邮件服务器 for Unix/Linux systems.
[root@server ~]# yum install dovecot
配置 Dovecot
打开 /etc/dovecot/dovecot.conf 更改如下配置:
## Line - umcomment ##
protocols = imap pop3 lmtp
打开 /etc/dovecot/conf.d/10-mail.conf:
## Line - uncomment ##
mail_location = maildir:~/Maildir (遇上面postfix一致)
打开 /etc/dovecot/conf.d/10-auth.conf:
## line - uncomment##
disable_plaintext_auth = yes (出现如果不要ssl验证的则是no) ## Line - Add a letter "login" ##
auth_mechanisms = plain login
打开 /etc/dovecot/conf.d/10-master.conf:
## Line , - Uncomment and add "postfix"
#mode =
user = postfix
group = postfix
开启 Dovecot 服务:
[root@server ~]# service dovecot start
Starting Dovecot Imap: [ OK ]
[root@server ~]# chkconfig dovecot on (加入系统启动项)
测试 Dovecot
[root@server ~]# telnet localhost pop3
Trying ::...
Connected to localhost.
Escape character is '^]'.
+OK Dovecot ready.
user fourone
+OK
pass ## Here is password of user "fourone" ##
+OK Logged in.
list
+OK messages: .
retr
+OK octets
Return-Path: <fourone@cnblogs.com>
X-Original-To: fourone
Delivered-To: fourone@cnblogs.com
Received: from localhost (localhost [IPv6:::])
by server.cnblogs.com (Postfix) with ESMTP id 3E68E284C
for <zl>; Wed, May :: + (IST)
Message-Id: <.3E68E284C@server.cnblogs.com>
Date: Wed, May :: + (IST)
From: fourone@cnblogs.com
To: undisclosed-recipients:; hello fourone
.
quit
+OK Logging out.
Connection closed by foreign host.
Dovecot 测试成功.
搭建邮件服务器 Postfix + Dovecot (CentOS)的更多相关文章
- Linux搭建邮件服务器Postfix+Dovecot+MySQL+PHP
用于搭建的服务器信息 阿里云 Centos 6.5 32位 安装过程1.安装Postfix 版本(2:2.6.6-8.el6) yum -y install postfix 安装完成还需要替换系统自带 ...
- Centos7搭建邮件服务器-Postfix+Cyrus-sasl+Courier-authlib+Dovecot+ExtMail+Centos7
1.环境介绍 MTA: Postfix 3.1.4 SASL: Cyrus-sasl 2.1.26 ; Courier-authlib 0.66.1(Cyrus-sasl使用Courier-authl ...
- CentOS利用postfix搭建邮件服务器
之前我用nodemailer通过163邮箱来发送邮件,不过没过几天就一直ETIMEDOUT,不知道什么原因,想着还是自己搭一个来发邮件可能靠谱点(flag?) 安装postfix CentOS 7 自 ...
- 搭建邮件服务器,使用Postfix与Dovecot收发电子邮件
小知识: 我们为什么要搭建邮件服务器呢?有时候我们处于一个局域网内,不能及时的分享各自的研究成果,迫切的需要一种能够借助于网络且建立在计算机之间的传输数据的方法.所以我们需要搭建邮件服务器,这样的话既 ...
- Postfix+Dovecot+MySQL搭建邮件服务器
网上有很多使用Postfix搭建邮件服务器的文章,但目前貌似没有看到较为完整的一篇.本例将尝试在Ubuntu系统中使用Postfix+Dovecot+MySQL搭建邮件服务器. 说到邮件服务器,网上有 ...
- CentOS 使用PostFix搭建邮件服务器
搭建环境: 关于PostFix是什么以及邮件服务器接受发送邮件流程网上有很多文章,这里就不再写了,这里只记录如何搭建邮件服务器,使用PostFix接受发送邮件 CentOS6.8 32位,postfi ...
- 阿里云CentOS Linux服务器上搭建邮件服务器遇到的问题
参考文章: 阿里云CentOS Linux服务器上用postfix搭建邮件服务器 Linux系统下邮件服务器的搭建(Postfix+Dovecot) 本来想自己搭建邮件服务器,但是看到一篇资料表示阿里 ...
- Linux中用postfix搭建邮件服务器实战详解
Linux中用postfix搭建邮件服务器实战详解 postfix是Wietse Venema在IBM的GPL协议之下开发的MTA(邮件传输代理)软件.Postfix试图更快.更容易管理.更安全,同时 ...
- 邮件服务器Postfix的管理 重启php-fpm
Postfix邮件系统安装与配置:Postfix,Cyrus-IMAP,Cyrus-sasl,Dovecot和SPFhttp://www.freehao123.com/postfix-cyrus/Ce ...
随机推荐
- git-SSH连接配置
1.1 在电脑端生成sshkey文件 打开git bash 输入: ssh-keygen -t rsa -C "xxxxxxx邮箱地址" 期间要输入两次密码[github远程添加s ...
- Dockerfile 部署应用执行脚本文件
FROM centos6.6:0.0.1 MAINTAINER syberos:wangmo RUN mv /etc/yum.repos.d/ /etc/yum.repos.d_bak/ && ...
- Azure上通过haproxy实现APP Gateway或WAF的http跳转https
Azure上的APP Gateway是七层负载均衡服务,WAF是APP Gateway服务的扩展.在实现七层负载均衡的同时,增加了WAF的功能,可以对后台的HTTP服务进行保护. Azure WAF采 ...
- pthread_cond_wait 详解
转自:http://www.xuebuyuan.com/2173853.html pthread_cond_wait() 用于阻塞当前线程,等待别的线程使用pthread_cond_signal()或 ...
- MySQL启动失败解决办法
本人大二,进了一家培训机构学了两年,然后跟着他们做项目,其实也是练习,然后过程中遇到好多错误,当时解决了,然后下次遇到又忘了,-_-! -_-||| 我就想通过写博客来记载一下我遇到的错误和解决的办 ...
- QT5提示can not find -lGL的解决方法
这是由于 Qt5.0 默认将OpenGL加入了工程,但是在机器上没有安装OpenGL,所以jonas只需要在机器上安装OpenGL即可 . 安装建立基本编译环境 首先不可或缺的,就是编译器与基本的 ...
- 问题:C# TrimEnd 去掉最后的逗号;结果: C#中 TrimEnd()用法
C#中 TrimEnd()用法 ①去除最后的逗号 string str=ab,cd,ef,; str=str.TrimEnd(new char[] { ',' }); 返回结果则是:ab,cd,ef ...
- oracle 启动停止过程
oracle 主要由两部分组成:instance和database .instance是指一组后台进程/线程和一块共享内存区域,而database是指存储在磁盘上的一组物理文件. 数据库启动包括三个步 ...
- [Python Study Notes]饼状图绘制
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ...
- Alert---点击拍照弹出对话框
/** * 照片对话框 *AlertDialog */ private void PhotoDialog() { AlertDialog.Builder builder = new Builder(m ...