银河麒麟 | ubuntu 搭建属于自己的邮件服务器

发布于:2025-06-21 ⋅ 阅读:(13) ⋅ 点赞:(0)

 

目录

遇权不绝就转root

更新系统

安装 Postfix

配置 Postfix

重启 Postfix

安装 Dovecot

配置 Dovecot

编辑 Dovecot 的 IMAP 配置文件

编辑 Dovecot 的用户认证配置文件

编辑 Dovecot 的服务配置文件

重启 Dovecot

安装发送邮箱功能

发送邮件

测试


遇权不绝就转root

    sudo -i

    更新系统

      apt update

      
      
        # 网不好的人别敲了,这玩意太久了apt upgrade -y

        安装 Postfix

          apt install -y postfix

          假设我的公司域名是 wmcode.com

          那么 我待会输入的邮件服务器主机名则是 mail.wmcode.com

          配置 Postfix

            vi /etc/postfix/main.cf

            配置前

              home_mailbox = Maildir/smtpd_sasl_type = dovecotsmtpd_sasl_path = private/authsmtpd_sasl_auth_enable = yessmtpd_sasl_local_domain = $myhostnamesmtpd_sasl_security_options = noanonymous,noplaintextsmtpd_sasl_tls_security_options = noanonymousbroken_sasl_auth_clients = yessmtpd_recipient_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_unauth_destinationsmtp_tls_security_level = maysmtpd_tls_security_level = maysmtp_tls_note_starttls_offer = yessmtpd_tls_CApath = /etc/ssl/certssmtpd_tls_cert_file = /etc/ssl/certs/server.crtsmtpd_tls_key_file = /etc/ssl/private/server.keysmtpd_tls_loglevel = 1smtpd_tls_received_header = yessmtpd_tls_auth_only = yes

              修改后

              重启 Postfix

                systemctl restart postfix

                安装 Dovecot

                  apt install -y dovecot-core dovecot-imapd dovecot-lmtpd dovecot-mysql

                  配置 Dovecot

                    vi /etc/dovecot/dovecot.conf

                    编辑 Dovecot 的 IMAP 配置文件

                      vi /etc/dovecot/conf.d/10-mail.conf

                      编辑 Dovecot 的用户认证配置文件

                        vi /etc/dovecot/conf.d/10-auth.conf
                          disable_plaintext_auth = noauth_mechanisms = plain login

                          编辑 Dovecot 的服务配置文件

                            vi /etc/dovecot/conf.d/10-master.conf
                              #修改以下内容service lmtp {  unix_listener /var/spool/postfix/private/dovecot-lmtp {    mode = 0600    user = postfix    group = postfix  }}service auth {  unix_listener /var/spool/postfix/private/auth {    mode = 0660    user = postfix    group = postfix  }}

                              重启 Dovecot

                                systemctl restart dovecot

                                安装发送邮箱功能

                                  apt install -y mailutils

                                  发送邮件

                                    echo "This is the email body" | mail -s "Test Subject" other_email@outlook.com -r chen@wmcode.com
                                    • echo "This is the email body":邮件正文内容。

                                    • mail -s "Test Subject":邮件主题。

                                    • other_email@outlook.com:收件人邮箱地址。

                                    • -r chen@wmcode.com:发件人邮箱地址。

                                    测试

                                    邮件可能在垃圾邮箱里面


                                    * Thanks you *

                                    如果觉得文章内容不错,随手帮忙点个赞在看转发一下,如果想第一时间收到推送,也可以给我个星标~谢谢你看我的文章


                                    *往期推荐 *

                                    银河麒麟 | ubuntu 安装运用 docker 容器,实现容器化部署项目

                                    银河麒麟 | ubuntu 安装zabbix监控设备信息(亲测包对)

                                    只需5步让你轻松导出学习通纯考试题目(JavaScript)

                                    国产操作系统-银河麒麟本地化部署Ollama国产开源的AI大模型Qwen3

                                    Ubuntu |  安装 Zabbix 一篇就够了

                                    彻底删除 Nginx + 重新安装

                                    Swagger | 手把手带你写自动生成接口文档的爽感(零基础亲测实用)

                                    SpringBoot整合Openfeign接入Kimi Ai!!超简单,居然没多少行代码??(附加兜底教程)

                                    SpringBoot接入Kimi实践记录轻松上手

                                    Wrod 也可以添加代码快啦!!快看有哪种你是会的吧!

                                    Linux | 零基础Ubuntu搭建JDK

                                    Maven | 站在初学者的角度配置与项目创建(新手必学会)

                                    Spring Ai | 极简代码从零带你一起走进AI项目(中英)

                                    Open Ai | 从零搭建属于你的Ai项目(中英结合)

                                    MongoDB | 零基础学习与Springboot整合ODM实现增删改查(附源码)

                                    Openfeign | 只传递城市代码,即可获取该地域实时的天气数据(免费的天气API)

                                    API接口到底是什么

                                    Redis | 缓存技术对后端的重要性,你知道多少?

                                    Mongodb | 基于Springboot开发综合社交网络应用的项目案例(中英)

                                    谈谈模块化设计在单体架构中的应用

                                    彻底讲清楚 单体架构、集群架构、分布式架构及扩展架构

                                    为什么还在使用单体架构

                                    2025年Java路线一条龙服务

                                    2025年健康新趋势:科技与生活方式的融合


                                    感谢阅读 | 更多内容尽在公棕号 WMCode | CSDN@小Mie不吃饭


                                    网站公告

                                    今日签到

                                    点亮在社区的每一天
                                    去签到