mail邮局系统的MX(邮件交换)记录配置,以便收发邮件。(MX记录,是邮件交换记录,它指向一个邮件服务器,用于电子邮件系统发邮件时根据收信人的地址后缀来定位邮件服务器,如果没有做域名解析,邮局不能正常使用,即不能正常的发送或者接收邮件。)

一、安装postfixdovecot

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

2dovecot配置

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配置多域名邮件服务器的更多相关文章

  1. 配置 Apache James 邮件服务器以使用加密邮件通讯协议

    可先参照: 使用 Apache James 3.3.0(开源免费) 搭建内网电子邮件服务器(基于 Windows + Amazon Corretto 8)https://www.cnblogs.com ...

  2. Windows Server 2008 R2 配置Exchange 2010邮件服务器

    windows server 服务器系统搭建邮件服务器一般两种情况: 1:Winmail server 软件 2:Exchange 参考教程:http://www.cnblogs.com/zhongw ...

  3. CentOS 64位下安装Postfix+Dovecot 配置邮件server笔记

    Postfix 和Dovecot功能确实非常强大,支持各种认证方式, 配置非常灵活, 就由于太过于灵活, 反而安装配置的过程中,easy有各种各样的陷阱,碰到问题了. 日志是最好的解决的方法了.    ...

  4. linux平台搭建postfix邮件服务器

    一,搭建邮件服务器前准备如下: Centos 7.2 64位Postfix-2.8.12.tar.gz Postfix MTA(邮件传输代理)Dovecot-2.1.8.tar.gz IMAP 和 P ...

  5. [RHEL] RHEL7.0 下 Postfix + Dovecot 实现邮件发送

    RHEL7.0 下 Postfix + Dovecot 实现邮件发送 一.前言 大家都对邮件服务(mail service)很感兴趣嘛.我在自己 博客站 预言了自己会实战一次,访问量一天到十几(毕竟平 ...

  6. Exchange 2010邮件服务器的搭建和部署

    Exchange主要是针对内部网或者企业网用户进行搭建的邮件服务器软件,利用它能够很快地搭建安全性较高的内部网邮件系统. 本次搭建在个人环境中实践,纯属爱好折腾,分四步骤,1.搭建windows 20 ...

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

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

  8. 烂泥:Postfix邮件服务器搭建之虚拟用户配置

    virtual_gid_maps = static: virtual_transport = dovecot dovecot_destination_recipient_limit = 1 注意:po ...

  9. CentOS7下搭建邮件服务器(dovecot + postfix + SSL)

    CentOS   花了基本上两天的时间去配置CentOS7下的邮件服务器.其中艰辛太多了,一定得总结下. 本文的目的在于通过一系列配置,在CentOS 7下搭建dovecot + postfix + ...

随机推荐

  1. 2. Shell 传递参数

    1. 概要 我们可以在执行 Shell脚本时,向脚本传递参数,脚本内获取参数的格式为:$n.n 代表一个数字,1 为执行脚本的第一个参数,2 为执行脚本的第二个参数,以此类推-- #!/bin/bas ...

  2. php 验证码类

    <?php  class Vcode {   private $width; //宽   private $height; //高   private $num;  //数量   private ...

  3. RLE行程长度编码压缩算法

    在看emWIN的时候看到一个图片压缩的算法可以有效的对二值图(简单的2中颜色或者更多)进行压缩,压缩的效果可以节省空间而且不丢失信息! 特点 一种压缩过的位图文件格式,RLE压缩方案是一种极其成熟的压 ...

  4. HDU 5755 Gambler Bo

    可以设n*m个未知量,建立n*m个方程.位置i,j可以建立方程 (2*x[i*m+j]+x[(i-1)*m+j]+x[(i+1)*m+j]+x[i*m+j-1]+x[i*m+j+1])%3=3-b[i ...

  5. php错误记录

    1.模板不存在ThinkPHP\Library\Think\View.class.php LINE: 110 是因为IndexController的Index函数,而View中没有对应的Index文件 ...

  6. Chapter 2 Open Book——2

    It was worse because I was tired; 更糟糕的是因为我疲惫了. I still couldn't sleep with the wind echoing around t ...

  7. apt-get 总结

    转自: apt-get 总结 1.apt-get install <package_name> install a new package. 2.apt-get build-dep < ...

  8. Hadoop中的一些基本操作

    先粗略说一下“hadoop fs”和“hadoop dfs”的区别:fs是各比较抽象的层面,在分布式环境中,fs就是dfs,但在本地环境中,fs是local file system,这个时候dfs不可 ...

  9. OpenCV——mixChannels函数

    mixChannels Copies specified channels from input arrays to the specified channels of output arrays. ...

  10. windows 装 centos

    windows下压缩一下空间 直接装centos 找到分配给linux的/boot目录,然后修改grub/menu.lst文件,更换一下位置即可