搭建邮件服务器 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 ...
随机推荐
- TexStudio 非常好用的Latex软件
先大概写一下,免得忘了,等有时间详细补充. 跨平台.免费. 语法高亮 方便的公式.符号选择界面 可以配置Latex,pdflatex,xelatex等默认编译命令 集成了pdf阅读器,可在阅读器中浏览 ...
- 手机访问PC网站自动跳转到手机网站代码(转)
4G时代,手机网站已经非常普遍了,一般手机网站都有一个二级域名来访问,比如 m.16css.com 如果手机直接访问www.16css.com 就是PC网站,在手机上浏览电脑版网站体验非常不好. 如果 ...
- VirtualBox-Debian7.2-share
1.在VirtualBox(用的版本是4.3.6)中,选择虚拟机->设置-> 共享文件夹, 2.添加一个主机上的文件夹readhat用来作为共享文件夹,选中固定分配和自动挂载, 结果:进入 ...
- salt-minion dead but pid file exists 正确解决方法
说明: 看了网上很多关于alt-minion dead but pid file exists 的解决方法,千篇一律的写一个shell脚本 killproc salt-minion 见链接:http: ...
- ASP.NET网站性能提升的几个方法
1. HTTP 压缩 HTTP 压缩通常用于压缩从服务端返回的页面内容.它压缩HTTP请求和响应,这个会是巨大的性能提升.我的项目是基于Window Server 2003开发的,可以参考这篇文章. ...
- mycat 新增分片和字符集
执行 select * from travelrecord ,分析Debug日志,说明整个执行逻辑,包括连接获取,连接同步信息,数据合并,数据返回,连接释放 新增一个分片表 T_VOTE (ID,PR ...
- [置顶]
getenv、setenv函数(获取和设置系统环境变量) 与 环境变量
1.getenv() 函数名: getenv 功 能: 从环境中取字符串,获取环境变量的值 头文件: stdlib.h 用 法:char *getenv(char *envvar); 函数说明:get ...
- 基于OpenCV的火焰检测(三)——HSI颜色判据
上文向大家介绍了如何用最简单的RGB判据来初步提取火焰区域,现在我要给大家分享的是一种更加直观的判据--HSI判据. 为什么说HSI判据是更加直观的判据呢?老规矩,先介绍一下HSI色彩模型: HSI颜 ...
- 简单的windows作业管理(自己也没弄透彻)
先把代码贴出来,以后有时间再研究!简单的说,作业就相当于沙箱,可以使程序在一定范围内活动. #include "stdafx.h"#include "windows.h& ...
- 搭建node.js
#node.js:概念介绍及安装 # python服务器.php ->aphche.java ->tomcat. iis # 它是一个可以运行JAVASCRIPTR 的运行环境 # 它可以 ...