centos7配置postfix dovecot cyrus-sasl foxmail

本文涉及的产品
RDS MySQL Serverless 基础系列,0.5-2RCU 50GB
云数据库 RDS MySQL,集群版 2核4GB 100GB
推荐场景:
搭建个人博客
RDS MySQL Serverless 高可用系列,价值2615元额度,1个月
简介:

第一步:(Windows本地安装foxmail测试两账号成功互收发)

yum install postfix dovecot cyrus-sasl cyrus-sasl-plain cyrus-sasl-md5


记录类型 主机记录 解析线路  记录值             MX优先级   TTL

 TXT  @      默认 v=spf1 ip4:111.11.11.11 -all  --    10分钟

 MX   @      默认  mail.wc365.com.          10    10分钟

 A   smtp    默认   111.11.11.11            --    10分钟

 A   mail    默认   111.11.11.11            --    10分钟

 A   pop3    默认   111.11.11.11            --    10分钟


# vi /etc/postfix/main.cf

myhostname = mail.wc365.com

mydomain = wc365.com

myorigin = $mydomain

inet_interfaces = all

inet_protocols = ipv4

mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain,

       mail.$mydomain, www.$mydomain, ftp.$mydomain

mynetworks = 0.0.0.0/0

home_mailbox = Maildir/(测试之后发现是与foxmail设置验证有关,必须要)

relay_domains = $mydestination

broken_sasl_auth_clients = yes

smtpd_client_restrictions = permit_sasl_authenticated

smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination

smtpd_sasl_auth_enable = yes

smtpd_sasl_local_domain = $mydomain

smtpd_sasl_security_options = noanonymous

message_size_limit = 5242880

# systemctl start postfix.service(检查25号端口)


# vi /etc/dovecot/dovecot.conf

protocols = imap pop3 lmtp

listen = *

# vi 10-auth.conf(没测试,暂时没用到)

disable_plaintext_auth = no

# vi 10-mail.conf(测试之后发现是与foxmail设置验证有关,必须要)

mail_location = maildir:~/Maildir

#mail_location = maildir:/var/mailbox/%d/%n/Maildir

mail_privileged_group = mail

# vi 10-ssl.conf(没测试,暂时没用到)

ssl = no

# systemctl start dovecot.service(检查110,143号端口)


# vi /etc/sysconfig/saslauthd

SOCKETDIR=/var/run/saslauthd

MECH=shadow


# cat /etc/sasl2/smtpd.conf

pwcheck_method: saslauthd

mech_list: plain login

# systemctl start saslauthd.service


增加用户:

userdel test1(删除用户)

groupdel test1(删除用户组)

useradd test2

echo 'test2' |passwd --stdin test2

useradd test3

echo 'test3' |passwd --stdin test3

vi /etc/passwd

test2:x:1001:2001::/home/test2:/sbin/nologin(不能登录系统)

test3:x:1002:2002::/home/test3:/sbin/nologin


测试1:

# telnet mail.wc365.com 25  

Trying 192.168.1.2...

Connected to mail.wc365.com (192.168.1.2).

Escape character is '^]'.

220 mail.yjw.com ESMTP Postfix

EHLO 163.com(只需要输入该行即可,一下都是现实信息)

250-mail.wc365.com

250-PIPELINING

250-SIZE 10240000

250-VRFY

250-ETRN

250-AUTH LOGIN PLAIN

250-AUTH=LOGIN PLAIN

250-ENHANCEDSTATUSCODES

250-8BITMIME

250 DSN

quit(输入退出命令)

221 2.0.0 Bye

Connection closed by foreign host.


测试2:

echo "this is a test mail" | mail -s mailname 123456789@qq.com(查看QQ邮箱是否有新邮件)


测试3:

Windows安装的foxmail客户端

新建--》手动设置--》配置如下--》创建--》确定(应用)--》邮件成功互收发即可

接受服务器类型:POP3

    邮件账号:test2@wc365.com

      密码: 123456

   POP服务器:mail.wc365.com    110

  SMTP服务器:mail.wc365.com     25


检查3:

默认的MTA是sendmail。所以我们需要键入以下命令更新MTA为Postfix

/usr/sbin/alternatives --set mta /usr/sbin/sendmail.postfix

再次检查看MTA是不是改为Postfix了

alternatives --display mta


报错1:postfix/sendmail[13310]: fatal: parameter inet_interfaces: no local interface found for ::1

解决1:

vi /etc/postfix/main.cf

#inet_protocols = all(注释掉该行)

#wc add1

inet_protocols = ipv4

systemctl start postfix(检查端口号查看是否起来)


报错2:ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (111)

解决2:ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock


报错3:dovecot: pop3-login: Aborted login (auth failed, 1 attempts in 4 secs

解决3:一般都是权限问题

ll /var/mail或者ll /home


报错4:error: mailbox_size_limit is smaller than message_size_limit

解决4:message_size_limit = 5120000(数值改小即可)


报错5:useradd: group wc exists - if you want to add this user to that group, use -g.

解决5:这是因为只删除了用户,用户组没有删除的原因

userdel test1(删除用户)

groupdel test1(删除用户组)


报错6:


第二步:

http://www.centoscn.com/CentosServer/lighttpd/2013/1010/1775.html


第三步:(加入mysql实现虚拟用户收发邮件)


本文转自 guowang327 51CTO博客,原文链接:http://blog.51cto.com/guowang327/1729098,如需转载请自行联系原作者

相关实践学习
如何在云端创建MySQL数据库
开始实验后,系统会自动创建一台自建MySQL的 源数据库 ECS 实例和一台 目标数据库 RDS。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与CDN、分析与搜索、云通信、网络、管理与监控、应用服务、互联网中间件、移动服务、视频服务等。通过本课程,来了解阿里云能够为你的业务带来哪些帮助     相关的阿里云产品:云服务器ECS 云服务器 ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。产品详情: https://www.aliyun.com/product/ecs
相关文章
|
4天前
|
Linux 开发工具
成功解决:CentOS 7中如何配置修改Vim
这篇文章介绍了如何在CentOS 7系统中配置和修改Vim编辑器的设置。文章首先指导读者如何检查Vim是否已经安装,如果未安装完全,提供了安装Vim的命令。接着,文章详细说明了如何编辑`/etc/vimrc`文件来配置Vim,包括设置显示行号、显示当前模式、光标位置信息、自动缩进和语法高亮等。最后,文章通过对比展示了配置前后使用vi和vim打开相同文本的效果差异,强调了Vim配置后的优势。
成功解决:CentOS 7中如何配置修改Vim
|
5天前
|
存储 缓存 Ubuntu
在Ubuntu 18.04上安装和配置Postfix的方法
在Ubuntu 18.04上安装和配置Postfix的方法
9 1
|
5天前
|
网络协议 Linux 网络安全
Hyper-v 如何配置 Centos7 虚拟机网络?
Hyper-v 如何配置 Centos7 虚拟机网络?
|
5天前
|
Ubuntu Linux 数据库
如何在Ubuntu 16.04上安装和配置Postfix作为仅发送的SMTP服务器
如何在Ubuntu 16.04上安装和配置Postfix作为仅发送的SMTP服务器
9 0
|
5天前
|
存储 Ubuntu 安全
在Ubuntu 14.04上安装和配置Postfix的方法
在Ubuntu 14.04上安装和配置Postfix的方法
11 0
|
5天前
|
Ubuntu 安全 测试技术
如何在Ubuntu 14.04上安装和配置Postfix作为仅发送的SMTP服务器
如何在Ubuntu 14.04上安装和配置Postfix作为仅发送的SMTP服务器
10 0
|
5天前
|
存储 安全 Java
在CentOS 7上安装和配置Elasticsearch的方法
在CentOS 7上安装和配置Elasticsearch的方法
20 0
|
5天前
|
JSON 运维 Linux
在CentOS 7上安装和配置Ansible的方法
在CentOS 7上安装和配置Ansible的方法
19 0
|
Linux 虚拟化
CentOS 7.X配置连接网络
应用场景 Linux虚拟机,系统安装完毕后,无法连接网络,由于是最小化安装,很多命令无法直接yum安装,无法连接外网wget下载资源等等,造成很大的不便,因此需要进行配置连接外网! 操作指南 1. 开启VMware NAT Service 右击“计算机”,选择“管理”,在“服务和应用程序”中,选择“服务”,在右边找到“VMware NAT Service”服务,进行开启。
1161 0
|
Linux 虚拟化 网络协议
CentOS 6.X配置连接网络
应用场景 Linux虚拟机,系统安装完毕后,无法连接网络,由于是最小化安装,很多命令无法直接yum安装,无法连接外网wget下载资源等等,造成很大的不便,因此需要进行配置连接外网! 操作指南 1. 开启VMware NAT Service 右击“计算机”,选择“管理”,在“服务和应用程序”中,选择“服务”,在右边找到“VMware NAT Service”服务,进行开启。
819 0