安装Postfix
yum install postfix -y
安装文档
yum-y安装文件
Postfix配置
vim /etc/postfix/main.cf
修改如下。
取消注释#75行:设置主机名称
my hostname=mailwestos.west OS.com
取消注释#83行:设置域名
mydomain=westos.me
#99行:取消注释
myorigin=$mydomain
#116行:修改
inet_interfaces=all
#119行:注释
inet_protocols=ipv4
#164添加行:
mydestination=$myhostname,localhost.$mydomain,localhost,$mydomain
添加到最后
#邮件的最大大小为10M
message_size_limit=10485760
#收件箱的最大容量为1G
mailbox_size_limit=1073741824
#SMTP认证
smtpd_sasl_type=dovecot
smtpd _ sasl _ path=私有/自动
smtpd_sasl_auth_enable=yes
smtpd _ sasl _ security _ options=noanonymous
smtpd _ sasl _ local _ domain=$ my hostname
smtpd _ recipient _ restrictions=permit _ my networks,permit_auth_destination,permit _ sasl _ au au au au au thenticated,
修改后,使用systemctl restart postfix启动postfix,使用systemctl enable postfix启动postfix。
配置文档
修改如下。
[ root @ mailwestos~] # vim/etc/dovecot/dovecot.conf
#24行:取消注释
protocols=imap pop3 lmtp
#48行:更改
log in _ trusted _ network=0.0.0.0/0
#49添加行:
disable_plaintext_auth=no
[ root @ mailwestos~] # vim/etc/dovecot/conf.d/10-mail.conf
添加#30行:
mail _ location=mbox :~~/mail : inbox=/var/mail/% u
[ root @ mailwestos~] systemctlrestartdovecot
开始文档IMAP : [确定]
[ root @ mailwestos~] # chkconfigdovecoton
到此为止,我们的邮件服务器已经构建成功了。
但是,从/etc/dovecot/conf.d/10-mail.conf传递的文件/mail:INBOX不存在,必须手动创建。
mkdir /home/mail
touch /home/mail/INBOX
5 .域名解析
最后,请不要忘记域名解析工作也是必要的。
具体构成前面的DNS章节来看
添加子域名称dns。 a记录解析为服务器172.25.254.100。
再添加一条MX记录。 主机记录为空,记录的值为上面解析的辅助域名mailwestos.westos.com,优先级为1。
例如:
注意:分析可能需要一段时间才能生效。
6 .使用邮箱
系统用户是邮件用户,例如student是邮箱用户,邮箱是student@westos.com,密码是sthudent的密码
例如使用软件Thunderbird
这样,您就可以像邮箱一样登录查看和发送邮件