postfix+dovecot配置多域名邮件服务器
mail邮局系统的MX(邮件交换)记录配置,以便收发邮件。(MX记录,是邮件交换记录,它指向一个邮件服务器,用于电子邮件系统发邮件时根据收信人的地址后缀来定位邮件服务器,如果没有做域名解析,邮局不能正常使用,即不能正常的发送或者接收邮件。)
一、安装postfix和dovecot
yum install postfix dovecot
chkconfig postfix on
chkconfig dovecot on
也可以用一次安装所有依赖包 yum install sysstat postfix crontabs redhat-lsb-graphics redhat-lsb-core arpwatch cronie dovecot
1、配置postfix
vi /etc/postfix/main.cf
# change or add on these line:
myhostname = yes81.net
mydomain = yes81.net
myorigin = $mydomain
inet_interfaces = all
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
mynetworks = 127.0.0.0/8
home_mailbox = Maildir/
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination, permit
broken_sasl_auth_clients = yes
2、dovecot配置
vi /etc/dovecot/dovecot.conf
# uncomment on this line:
protocols = imap pop3
listen = *
3、配置认证方式
vi /etc/dovecot/conf.d/10-auth.conf
# change on these line:
disable_plaintext_auth = no
auth_mechanisms = plain login
4、设置邮箱文件夹
vi /etc/dovecot/conf.d/10-mail.conf
mail_location = maildir:~/Maildir
5、配置认证
vi /etc/dovecot/conf.d/10-master.conf
# commented on these line:
#unix_listener auth-userdb {
#mode = 0600
#user =
#group =
#}
# change or setup on these line:
# Postfix smtp-auth
unix_listener /var/spool/postfix/private/auth {
mode = 0666
user = postfix
group = postfix
}
6、配置pop3
vi /etc/dovecot/conf.d/20-pop3.conf
# uncomment on these line:
pop3_uidl_format = %08Xu%08Xv
pop3_client_workarounds = outlook-no-nuls oe-ns-eoh
7、重启dovecot 、postfix
Service dovecot restart
Service postfix restart
8、增加用户和设置用户密码
这个时候就可以增加用户和设置用户密码,然后测试收发
groupadd mailuser
adduser -g mailuser -s /sbin/nologin test1
passwd test1
adduser -g mailuser -s /sbin/nologin test2
passwd test2
打开FOXMAIL等邮件工具测试,能正常收发,就表示系统可以了。
test1@mail.yes81.net test2@mail.yes81.net
二、 如果无法发信
试着发送邮件,如果发送不出去,查看日志文件/var/log/maillog 如果显示:
postfix/smtp[17105]: fatal: unknown service: smtp/tcp
postfix/smtpd: disconnect from unknown[113.64.242.145]
postfix/qmgr: warning: private/smtp socket: malformed response
postfix/qmgr: warning: transport smtp failure -- see a previous warning/fatal/panic logfile record for the problem description
postfix/master: warning: process /usr/libexec/postfix/smtp pid 17105 exit status 1
postfix/master: warning: /usr/libexec/postfix/smtp: bad command startup -- throttling
这是由于邮件默认的postfix账号无法执行/etc/services,权限不足所致。查看service的权限为640:
Chmod 644 /etc/services 于是将其改为644:
重新启动2个服务后就可以看到,一切正常了!
三、如何添加虚拟域名:
http://www.postfix.org/VIRTUAL_README.html
按照官方指导,对于多域名的支持postfix支持以下几种方式:
1.共享域名,共享Unix账户
2.虚拟别名(Virtual Alias)独立域名,共享Unix账户
3.虚拟邮箱(Virtual Mailbox)独立域名,无需Unix账户
4.转发服务器(Forwarding Server)用做备份服务器,主服务器故障时暂存邮件,恢复后直接转发给主服务器
从官网查到后,决定采用第2种方法:虚拟别名(Virtual Alias)独立域名,共享Unix账户
vi /etc/postfix/main.cf
virtual_alias_domains = t3t3.org
virtual_alias_maps = hash:/etc/postfix/virtual
alias_maps=hash:/etc/aliases
vi /etc/postfix/virtual
test1@t3t3.org test1
test2@t3t3.org test2
test1@yes81.net test1
test2@yes81.net test2
vi /etc/aliases //把刚添加的帐号做个别名
test1: test1
test2: test2
postmap /etc/postfix/virtual //reload 数据库后需新域名就可以使用了
postalias /etc/aliases // postfix /etc/aliases命令是否等同?
newaliases
postfix reload //reload
Service dovecot restart //重新启动
Service postfix restart //重新启动
如果操作postfix /etc/aliases时候出现/usr/libexec/postfix/postfix-script: line 337: /etc/aliases: Permission denied则需要修改权限:
chmod 664 /etc/aliases
chown root /etc/aliases
chmod 755 /etc/aliases.db
chown smmsp /etc/aliases.db
修改好权限后,再次执行reload和重新等命令
如此后邮件服务器就可以用test1@yes81.net test1@t3t3.org进行收发邮件了。
postfix+dovecot配置多域名邮件服务器的更多相关文章
- 配置 Apache James 邮件服务器以使用加密邮件通讯协议
可先参照: 使用 Apache James 3.3.0(开源免费) 搭建内网电子邮件服务器(基于 Windows + Amazon Corretto 8)https://www.cnblogs.com ...
- Windows Server 2008 R2 配置Exchange 2010邮件服务器
windows server 服务器系统搭建邮件服务器一般两种情况: 1:Winmail server 软件 2:Exchange 参考教程:http://www.cnblogs.com/zhongw ...
- CentOS 64位下安装Postfix+Dovecot 配置邮件server笔记
Postfix 和Dovecot功能确实非常强大,支持各种认证方式, 配置非常灵活, 就由于太过于灵活, 反而安装配置的过程中,easy有各种各样的陷阱,碰到问题了. 日志是最好的解决的方法了. ...
- linux平台搭建postfix邮件服务器
一,搭建邮件服务器前准备如下: Centos 7.2 64位Postfix-2.8.12.tar.gz Postfix MTA(邮件传输代理)Dovecot-2.1.8.tar.gz IMAP 和 P ...
- [RHEL] RHEL7.0 下 Postfix + Dovecot 实现邮件发送
RHEL7.0 下 Postfix + Dovecot 实现邮件发送 一.前言 大家都对邮件服务(mail service)很感兴趣嘛.我在自己 博客站 预言了自己会实战一次,访问量一天到十几(毕竟平 ...
- Exchange 2010邮件服务器的搭建和部署
Exchange主要是针对内部网或者企业网用户进行搭建的邮件服务器软件,利用它能够很快地搭建安全性较高的内部网邮件系统. 本次搭建在个人环境中实践,纯属爱好折腾,分四步骤,1.搭建windows 20 ...
- 烂泥:Postfix邮件服务器搭建之软件安装与配置
本文由ilanniweb提供友情赞助,首发于烂泥行天下 想要获得更多的文章,可以关注我的微信ilanniweb Postfix邮件服务器的搭建需要使用到几个软件,分别是cyrus-sasl.postf ...
- 烂泥:Postfix邮件服务器搭建之虚拟用户配置
virtual_gid_maps = static: virtual_transport = dovecot dovecot_destination_recipient_limit = 1 注意:po ...
- CentOS7下搭建邮件服务器(dovecot + postfix + SSL)
CentOS 花了基本上两天的时间去配置CentOS7下的邮件服务器.其中艰辛太多了,一定得总结下. 本文的目的在于通过一系列配置,在CentOS 7下搭建dovecot + postfix + ...
随机推荐
- 修改jsonb的属性
CREATE FUNCTION jsonb_merge(JSONB, JSONB) RETURNS JSONB AS $$ WITH json_union AS ( SELECT * FROM JSO ...
- JPA基本注解介绍
一.@Entity •@Entity 标注用于实体类声明语句之前, 指出该Java 类为实体类,将映射到指定的数据库表. 如声明一个实体类 Customer,它将映射到数据库中的 customer 表 ...
- HDU 4585 Shaolin (set的应用)
set是STL中非常方便的工具,可以实现自动去重和排序,可我一直忽视它的重要性,导致吃了好几次亏. 在思考这道题的时候,我一直往二分上靠拢,可是二分需要直接插入排序,直接插入排序覆盖的时候复杂度最大是 ...
- 阅读http://zh.lucida.me/有感
lucida大神本科毕业于大工,研究生毕业于北航,有这样的学历在社会上混就已经绰绰有余了,但是lucida神并不满足,刻苦努力,拼搏进取,最后进入google london工作,曾经一度在micros ...
- oracle 同义词
同义词概念 Oracle的同义词(synonyms)从字面上理解就是别名的意思,和视图的功能类似,就是一种映射关系.它可以节省大量的数据库空间,对不同用户的操作同一张表没有多少差别;它扩展了数据库的使 ...
- Storm官方文档翻译之创建Storm项目
本文将讲述如何在开发环境创建一个Storm项目,下面是步骤: 1.将Storm的相关jar包添加到classpath中: 2.如果使用多语言开发,也要将多语言目录添加到classpath; 点击sto ...
- gridview列绑定HyperLink
<asp:HyperLink ID="HyperLink1" Target="_blank" runat="server" Navig ...
- python3.5 + django1.9.1+mysql
python3 对mysql 的驱动不再是mysqldb 具体步骤 : 1 安装依赖 pip install PyMySQL 2 修改配置 __init__.py import pymysql pym ...
- psy
本文的重点是讲解如何运用心理线指标看盘,运用周线月线的心理线来抓住大盘的顶部和底部的研究.分析研究的材料都来源于沪市历史上的顶部和底部的历史数据.从psy数据所得出的结论大多数是有效的,只有个别时期的 ...
- docker容器和镜像区别
这篇文章希望能够帮助读者深入理解Docker的命令,还有容器(container)和镜像(image)之间的区别,并深入探讨容器和运行中的容器之间的区别. 当我对Docker技术还是一知半解的时候,我 ...