<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>电子邮件 - 标签 - Refrain69 的博客</title><link>https://blog.refrain69.com/tags/%E7%94%B5%E5%AD%90%E9%82%AE%E4%BB%B6/</link><description>电子邮件 - 标签 - Refrain69 的博客</description><generator>Hugo -- gohugo.io</generator><language>zh-CN</language><managingEditor>contact@refrain69.com (Refrain69)</managingEditor><webMaster>contact@refrain69.com (Refrain69)</webMaster><copyright>This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.</copyright><lastBuildDate>Thu, 30 Apr 2026 12:04:22 +0800</lastBuildDate><atom:link href="https://blog.refrain69.com/tags/%E7%94%B5%E5%AD%90%E9%82%AE%E4%BB%B6/" rel="self" type="application/rss+xml"/><item><title>自定义域名邮箱配置</title><link>https://blog.refrain69.com/posts/custom-domain-email-setup/</link><pubDate>Thu, 30 Apr 2026 12:04:22 +0800</pubDate><author><name>Refrain69</name></author><guid>https://blog.refrain69.com/posts/custom-domain-email-setup/</guid><description><![CDATA[<p>当你拥有一个自定义域名 <code>example.com</code> 时，你可以配置以该域名或其子域名为后缀的邮箱地址，例如 <code>user@example.com</code> 或者 <code>user@contact.example.com</code>。下文介绍如何零成本实现这一功能，并且支持收发邮件和 OpenPGP 加密。</p>
<h2 id="前置条件" class="headerLink">
    <a href="#%e5%89%8d%e7%bd%ae%e6%9d%a1%e4%bb%b6" class="header-mark"></a>1 前置条件</h2><p>在执行接下来的步骤之前，请确保你已经完成了以下准备工作：</p>
<ul>
<li>
<p>一个托管在 Cloudflare 上的自定义域名，例如 <code>example.com</code></p>
<div class="details admonition warning open">
    <div class="details-summary admonition-title">
        <span class="icon"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M569.517 440.013C587.975 472.007 564.806 512 527.94 512H48.054c-36.937 0-59.999-40.055-41.577-71.987L246.423 23.985c18.467-32.009 64.72-31.951 83.154 0l239.94 416.028zM288 354c-25.405 0-46 20.595-46 46s20.595 46 46 46 46-20.595 46-46-20.595-46-46-46zm-43.673-165.346l7.418 136c.347 6.364 5.609 11.346 11.982 11.346h48.546c6.373 0 11.635-4.982 11.982-11.346l7.418-136c.375-6.874-5.098-12.654-11.982-12.654h-63.383c-6.884 0-12.356 5.78-11.981 12.654z"/></svg></span>警告<span class="details-icon"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M224.3 273l-136 136c-9.4 9.4-24.6 9.4-33.9 0l-22.6-22.6c-9.4-9.4-9.4-24.6 0-33.9l96.4-96.4-96.4-96.4c-9.4-9.4-9.4-24.6 0-33.9L54.3 103c9.4-9.4 24.6-9.4 33.9 0l136 136c9.5 9.4 9.5 24.6.1 34z"/></svg></span>
    </div>
    <div class="details-content">
        <div class="admonition-content">尽管免费的二级域名可能也可以使用，但是强烈建议使用自己购买的域名。</div></div></div>
</li>
<li>
<p>本地安装了 <a href="https://www.thunderbird.net/" target="_blank" rel="noopener noreferrer">Thunderbird</a> (或其他支持 IMAP 和 SMTP 的邮件客户端)</p>
</li>
<li>
<p>一个可以收发邮件的辅助邮箱（例如 Gmail、Outlook、QQ 邮箱等，不限），并且已经添加到 Thunderbird 中，例如 <code>alice@gmail.com</code></p>
</li>
</ul>
<h2 id="收件" class="headerLink">
    <a href="#%e6%94%b6%e4%bb%b6" class="header-mark"></a>2 收件</h2><h3 id="配置-dns" class="headerLink">
    <a href="#%e9%85%8d%e7%bd%ae-dns" class="header-mark"></a>2.1 配置 DNS</h3><p>登录 <a href="https://dash.cloudflare.com/" target="_blank" rel="noopener noreferrer">Cloudflare</a> 后，进入你的域名管理界面，找到<strong>电子邮件</strong> -&gt; <strong>电子邮件路由</strong>。</p>
<ul>
<li>
<p>如果你之前没有设置过邮件路由，会弹出<strong>电子邮件路由入门指南</strong>，指导你添加一系列的 DNS 记录。点击左下角的<strong>添加记录并启用</strong>即可。</p>
</li>
<li>
<p>如果你之前已经设置过邮件路由，会直接进入<strong>电子邮件路由</strong>的<strong>概述</strong>页面。转到<strong>设置</strong>页面，找到<strong>域</strong>部分。</p>
<p>如果<strong>通过电子邮件发送 DNS 记录</strong>的状态是<strong>配置错误</strong> (如下图)，点击右侧的 <strong>&hellip;</strong>，选择<strong>修复记录</strong>。</p>
<a class="lightgallery" href="/posts/custom-domain-email-setup/1.png" title="电子邮件 DNS 配置" data-thumbnail="/posts/custom-domain-email-setup/1.png"><img  loading="lazy" src='/posts/custom-domain-email-setup/1.png' srcset="/posts/custom-domain-email-setup/1_hu_65a715b92b812064.webp 800w, /posts/custom-domain-email-setup/1_hu_a6db77cf993b601e.webp 1200w, /posts/custom-domain-email-setup/1_hu_d6537f61f78aa21d.webp 1600w" sizes="auto" alt="电子邮件 DNS 配置" height="270" width="1927"></a>
</li>
</ul>
<h3 id="设置路由" class="headerLink">
    <a href="#%e8%ae%be%e7%bd%ae%e8%b7%af%e7%94%b1" class="header-mark"></a>2.2 设置路由</h3><ol>
<li>
<p>在<strong>电子邮件路由</strong>的<strong>目标地址</strong>页面，添加之前准备好的邮箱地址。</p>
</li>
<li>
<p>在<strong>路由规则</strong>页面，找到<strong>自定义地址</strong>部分，创建地址。</p>
<ul>
<li>
<p>自定义地址：输入你想要的邮箱地址，例如 <code>test@example.com</code></p>
</li>
<li>
<p>操作：发送到电子邮件</p>
</li>
<li>
<p>目标：选择之前添加到 Thunderbird 的辅助邮箱，例如 <code>alice@gmail.com</code></p>
</li>
</ul>
</li>
</ol>
<h2 id="发件" class="headerLink">
    <a href="#%e5%8f%91%e4%bb%b6" class="header-mark"></a>3 发件</h2><p>此处我们选择 <a href="https://ahasend.com/" target="_blank" rel="noopener noreferrer">AhaSend</a> 作为 SMTP 服务提供商。AhaSend 免费套餐每月 1000 封邮件，足够个人使用。</p>
<h3 id="注册账号" class="headerLink">
    <a href="#%e6%b3%a8%e5%86%8c%e8%b4%a6%e5%8f%b7" class="header-mark"></a>3.1 注册账号</h3><p>不再赘述。注意不能用 Gmail 等公共邮箱注册，可以使用上一步配置好的邮箱地址注册。</p>
<h3 id="配置-dns-1" class="headerLink">
    <a href="#%e9%85%8d%e7%bd%ae-dns-1" class="header-mark"></a>3.2 配置 DNS</h3><p>登录 AhaSend 后，进入 <strong>Domains</strong> 页面，点击 <strong>Create a new domain</strong>，输入你的域名，例如 <code>example.com</code>。</p>
<p>AhaSend 会生成一系列 DNS 记录，按照提示在 Cloudflare 中添加这些记录。</p>
<div class="details admonition note open">
    <div class="details-summary admonition-title">
        <span class="icon"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M497.9 142.1l-46.1 46.1c-4.7 4.7-12.3 4.7-17 0l-111-111c-4.7-4.7-4.7-12.3 0-17l46.1-46.1c18.7-18.7 49.1-18.7 67.9 0l60.1 60.1c18.8 18.7 18.8 49.1 0 67.9zM284.2 99.8L21.6 362.4.4 483.9c-2.9 16.4 11.4 30.6 27.8 27.8l121.5-21.3 262.6-262.6c4.7-4.7 4.7-12.3 0-17l-111-111c-4.8-4.7-12.4-4.7-17.1 0zM124.1 339.9c-5.5-5.5-5.5-14.3 0-19.8l154-154c5.5-5.5 14.3-5.5 19.8 0s5.5 14.3 0 19.8l-154 154c-5.5 5.5-14.3 5.5-19.8 0zM88 424h48v36.3l-64.5 11.3-31.1-31.1L51.7 376H88v48z"/></svg></span>注意<span class="details-icon"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M224.3 273l-136 136c-9.4 9.4-24.6 9.4-33.9 0l-22.6-22.6c-9.4-9.4-9.4-24.6 0-33.9l96.4-96.4-96.4-96.4c-9.4-9.4-9.4-24.6 0-33.9L54.3 103c9.4-9.4 24.6-9.4 33.9 0l136 136c9.5 9.4 9.5 24.6.1 34z"/></svg></span>
    </div>
    <div class="details-content">
        <div class="admonition-content"><p>由于我们接下来要设置 OpenPGP，Tracking 可能会影响邮件的完整性导致解密失败，所以<strong>不要添加</strong> <code>Tracking domain</code> 相关的 DNS 记录。</p>
<p><a class="lightgallery" href="/posts/custom-domain-email-setup/2.png" title="Tracking domain" data-thumbnail="/posts/custom-domain-email-setup/2.png"><img  loading="lazy" src='/posts/custom-domain-email-setup/2.png' srcset="/posts/custom-domain-email-setup/2_hu_81bc283ad000898.webp 800w, /posts/custom-domain-email-setup/2_hu_47c8e440c4150293.webp 1200w, /posts/custom-domain-email-setup/2_hu_9b0a461439d26989.webp 1600w" sizes="auto" alt="Tracking domain" height="682" width="1221"></a></p>
</div></div></div>
<div class="details admonition note open">
    <div class="details-summary admonition-title">
        <span class="icon"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M497.9 142.1l-46.1 46.1c-4.7 4.7-12.3 4.7-17 0l-111-111c-4.7-4.7-4.7-12.3 0-17l46.1-46.1c18.7-18.7 49.1-18.7 67.9 0l60.1 60.1c18.8 18.7 18.8 49.1 0 67.9zM284.2 99.8L21.6 362.4.4 483.9c-2.9 16.4 11.4 30.6 27.8 27.8l121.5-21.3 262.6-262.6c4.7-4.7 4.7-12.3 0-17l-111-111c-4.8-4.7-12.4-4.7-17.1 0zM124.1 339.9c-5.5-5.5-5.5-14.3 0-19.8l154-154c5.5-5.5 14.3-5.5 19.8 0s5.5 14.3 0 19.8l-154 154c-5.5 5.5-14.3 5.5-19.8 0zM88 424h48v36.3l-64.5 11.3-31.1-31.1L51.7 376H88v48z"/></svg></span>注意<span class="details-icon"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M224.3 273l-136 136c-9.4 9.4-24.6 9.4-33.9 0l-22.6-22.6c-9.4-9.4-9.4-24.6 0-33.9l96.4-96.4-96.4-96.4c-9.4-9.4-9.4-24.6 0-33.9L54.3 103c9.4-9.4 24.6-9.4 33.9 0l136 136c9.5 9.4 9.5 24.6.1 34z"/></svg></span>
    </div>
    <div class="details-content">
        <div class="admonition-content">注意在 Cloudflare 中添加 DNS 记录时，<strong>不要启用代理</strong>，保持<strong>仅 DNS</strong> 模式。</div></div></div>
<p>等待一段时间，直到 AhaSend 显示域名的各项 DNS 配置状态都是 <strong>Ready</strong>。</p>
<h3 id="配置-smtp" class="headerLink">
    <a href="#%e9%85%8d%e7%bd%ae-smtp" class="header-mark"></a>3.3 配置 SMTP</h3><p>进入 <strong>Credentials</strong> 页面，点击 <strong>Create a new credential</strong>。</p>
<ul>
<li>
<p>Type：选择 <strong>SMTP</strong></p>
</li>
<li>
<p>Name：随意</p>
</li>
<li>
<p>Mode：选择 <strong>Production</strong></p>
</li>
<li>
<p>Scope：选择 <strong>Scoped to specific domains</strong>，选择刚才添加的域名。</p>
</li>
</ul>
<a class="lightgallery" href="/posts/custom-domain-email-setup/3.png" title="创建 SMTP 凭证" data-thumbnail="/posts/custom-domain-email-setup/3.png"><img  loading="lazy" src='/posts/custom-domain-email-setup/3.png' srcset="/posts/custom-domain-email-setup/3_hu_ede6caa35e5ac682.webp 800w, /posts/custom-domain-email-setup/3_hu_5c11b0be7f683c7d.webp 1200w, /posts/custom-domain-email-setup/3_hu_e7a0ffdf47a726a3.webp 1600w" sizes="auto" alt="创建 SMTP 凭证" height="1174" width="787"></a>
<p>打开创建的凭证，记录 <strong>Username</strong>、<strong>Password</strong>、<strong>Server</strong>、<strong>Port</strong> 备用。</p>
<h3 id="配置邮件客户端" class="headerLink">
    <a href="#%e9%85%8d%e7%bd%ae%e9%82%ae%e4%bb%b6%e5%ae%a2%e6%88%b7%e7%ab%af" class="header-mark"></a>3.4 配置邮件客户端</h3><ol>
<li>
<p>打开 Thunderbird，进入<strong>账户设置</strong>，选择左列最下边的<strong>发件服务器</strong>。点击<strong>添加</strong>，输入以下信息：</p>
<ul>
<li>
<p>描述：随意</p>
</li>
<li>
<p>服务器名称：填写 AhaSend 的 Server</p>
</li>
<li>
<p>端口：填写 AhaSend 的 Port</p>
</li>
<li>
<p>连接安全性：选择 <strong>STARTTLS</strong></p>
</li>
<li>
<p>身份验证方法：选择 <strong>普通密码</strong></p>
</li>
<li>
<p>用户名：填写 AhaSend 的 Username</p>
</li>
</ul>
</li>
<li>
<p>选择左列的<strong>之前添加到 Thunderbird 的辅助邮箱</strong> (例如 <code>alice@gmail.com</code>)，设置右侧的<strong>默认身份</strong>：</p>
<ul>
<li>
<p>您的姓名：随意</p>
</li>
<li>
<p>电子邮件：填写之前配置的自定义邮箱地址，例如 <code>test@example.com</code>。这样发送邮件时就会使用该身份作为发件人。</p>
</li>
</ul>
</li>
<li>
<p>修改<strong>发件服务器</strong>为之前创建的 AhaSend 发件服务器。</p>
</li>
</ol>
<h2 id="openpgp-加密" class="headerLink">
    <a href="#openpgp-%e5%8a%a0%e5%af%86" class="header-mark"></a>4 OpenPGP 加密</h2><p>打开 Thunderbird 的<strong>账户设置</strong>，找到左列的<strong>之前添加到 Thunderbird 的辅助邮箱</strong> (例如 <code>alice@gmail.com</code>) 下面的<strong>端到端加密</strong>。</p>
<a class="lightgallery" href="/posts/custom-domain-email-setup/4.png" title="OpenPGP 设置" data-thumbnail="/posts/custom-domain-email-setup/4.png"><img  loading="lazy" src='/posts/custom-domain-email-setup/4.png' srcset="/posts/custom-domain-email-setup/4_hu_1aa3b23945019390.webp 800w, /posts/custom-domain-email-setup/4_hu_3afcd1dd110282af.webp 1200w, /posts/custom-domain-email-setup/4_hu_79f44aff3cdffaca.webp 1600w" sizes="auto" alt="OpenPGP 设置" height="508" width="1149"></a>
<p>点击<strong>添加密钥</strong> -&gt; <strong>新建 OpenPGP 密钥</strong>，选择<strong>之前设置的身份标识</strong>，按需配置密钥到期日和密钥类型、大小（建议使用 ECC）等，点击<strong>生成密钥</strong>。</p>
<p>生成完成后，回到<strong>端到端加密</strong>页面，向下找到<strong>高级设置</strong>，全部勾选。</p>
<a class="lightgallery" href="/posts/custom-domain-email-setup/5.png" title="OpenPGP 高级设置" data-thumbnail="/posts/custom-domain-email-setup/5.png"><img  loading="lazy" src='/posts/custom-domain-email-setup/5.png' srcset="/posts/custom-domain-email-setup/5_hu_56fe48007ea793d6.webp 800w, /posts/custom-domain-email-setup/5_hu_9f91bb6c5d9a30fb.webp 1200w, /posts/custom-domain-email-setup/5_hu_84bdd3ecfb7d1c46.webp 1600w" sizes="auto" alt="OpenPGP 高级设置" height="243" width="628"></a>
<p>你可以选择在密钥服务器（如 keys.openpgp.org 等）上发布密钥，以便其他人通过你的邮箱地址找到公钥发送加密邮件给你。</p>
<h2 id="高级设置" class="headerLink">
    <a href="#%e9%ab%98%e7%ba%a7%e8%ae%be%e7%bd%ae" class="header-mark"></a>5 高级设置</h2><h3 id="设置多个邮箱地址" class="headerLink">
    <a href="#%e8%ae%be%e7%bd%ae%e5%a4%9a%e4%b8%aa%e9%82%ae%e7%ae%b1%e5%9c%b0%e5%9d%80" class="header-mark"></a>5.1 设置多个邮箱地址</h3><p>我们可以利用一个辅助邮箱来实现多个自定义邮箱地址的收发邮件功能。</p>
<h4 id="收件-1" class="headerLink">
    <a href="#%e6%94%b6%e4%bb%b6-1" class="header-mark"></a>5.1.1 收件</h4><p>在 Cloudflare 的<strong>电子邮件路由</strong> -&gt; <strong>路由规则</strong>页面，添加多个<strong>自定义地址</strong>即可。</p>
<h4 id="发件-1" class="headerLink">
    <a href="#%e5%8f%91%e4%bb%b6-1" class="header-mark"></a>5.1.2 发件</h4><p>在 Thunderbird 中，进入<strong>账户设置</strong>，选择左列的<strong>之前添加到 Thunderbird 的辅助邮箱</strong> (例如 <code>alice@gmail.com</code>) ，点击最下方的<strong>管理标识</strong>。在此处添加新的身份。</p>
<p>发件时选择不同的身份，就会使用对应的自定义邮箱地址作为发件人了。</p>
<h4 id="openpgp-加密-1" class="headerLink">
    <a href="#openpgp-%e5%8a%a0%e5%af%86-1" class="header-mark"></a>5.1.3 OpenPGP 加密</h4><p>为新的身份标识生成新的 OpenPGP 密钥。这样，在发送邮件时选择不同的身份，就会使用对应的密钥进行加密了。</p>
<h3 id="设置子域名邮箱地址" class="headerLink">
    <a href="#%e8%ae%be%e7%bd%ae%e5%ad%90%e5%9f%9f%e5%90%8d%e9%82%ae%e7%ae%b1%e5%9c%b0%e5%9d%80" class="header-mark"></a>5.2 设置子域名邮箱地址</h3><p>如果你想使用类似 <code>user@sub.example.com</code> 的子域名邮箱地址，需要执行以下步骤：</p>
<ol>
<li>
<p>登录 <a href="https://dash.cloudflare.com/" target="_blank" rel="noopener noreferrer">Cloudflare</a> 后，进入你的域名管理界面，找到<strong>电子邮件</strong> -&gt; <strong>电子邮件路由</strong> -&gt; <strong>设置</strong>页面，找到<strong>子域</strong>部分，添加子域。这一步会添加一些新的 DNS 记录。</p>
</li>
<li>
<p>在<strong>电子邮件路由</strong>的<strong>路由规则</strong>页面，配置新的子域邮箱地址的路由规则。</p>
</li>
<li>
<p>在 AhaSend 的 <strong>Domains</strong> 页面，<strong>添加新的子域名</strong>，并按照提示添加 DNS 记录。添加完成后，创建新的 SMTP 凭证，选择添加的子域名。</p>
<div class="details admonition note open">
    <div class="details-summary admonition-title">
        <span class="icon"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M497.9 142.1l-46.1 46.1c-4.7 4.7-12.3 4.7-17 0l-111-111c-4.7-4.7-4.7-12.3 0-17l46.1-46.1c18.7-18.7 49.1-18.7 67.9 0l60.1 60.1c18.8 18.7 18.8 49.1 0 67.9zM284.2 99.8L21.6 362.4.4 483.9c-2.9 16.4 11.4 30.6 27.8 27.8l121.5-21.3 262.6-262.6c4.7-4.7 4.7-12.3 0-17l-111-111c-4.8-4.7-12.4-4.7-17.1 0zM124.1 339.9c-5.5-5.5-5.5-14.3 0-19.8l154-154c5.5-5.5 14.3-5.5 19.8 0s5.5 14.3 0 19.8l-154 154c-5.5 5.5-14.3 5.5-19.8 0zM88 424h48v36.3l-64.5 11.3-31.1-31.1L51.7 376H88v48z"/></svg></span>注意<span class="details-icon"><svg class="icon"
    xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 512"><!-- Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M224.3 273l-136 136c-9.4 9.4-24.6 9.4-33.9 0l-22.6-22.6c-9.4-9.4-9.4-24.6 0-33.9l96.4-96.4-96.4-96.4c-9.4-9.4-9.4-24.6 0-33.9L54.3 103c9.4-9.4 24.6-9.4 33.9 0l136 136c9.5 9.4 9.5 24.6.1 34z"/></svg></span>
    </div>
    <div class="details-content">
        <div class="admonition-content">如果之前已经添加了主域名，此处仍需重新添加子域名，并且添加新的 DNS 记录。</div></div></div>
</li>
<li>
<p>在 Thunderbird 中，添加新的身份标识，使用新的子域名邮箱地址。</p>
</li>
<li>
<p>为新的身份标识生成新的 OpenPGP 密钥。</p>
</li>
</ol>
]]></description></item></channel></rss>