mirror of
https://github.com/Dichgrem/Blog.git
synced 2025-07-31 17:09:30 -04:00
247 lines
9.5 KiB
HTML
247 lines
9.5 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="en">
|
||
|
||
<head>
|
||
<title>Dich'blog</title>
|
||
|
||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1">
|
||
<meta name="robots" content="noodp"/>
|
||
|
||
<link rel="stylesheet" href="https://blog.dich.bid/style.css">
|
||
<link rel="stylesheet" href="https://blog.dich.bid/color/blue.css">
|
||
|
||
<link rel="stylesheet" href="https://blog.dich.bid/color/background_dark.css">
|
||
|
||
<link rel="stylesheet" href="https://blog.dich.bid/font-hack-subset.css">
|
||
|
||
<meta name="description" content="">
|
||
|
||
<meta property="og:description" content="">
|
||
<meta property="og:title" content="Dich'blog">
|
||
<meta property="og:type" content="article">
|
||
<meta property="og:url" content="https://blog.dich.bid/network-how-email-works-3/">
|
||
|
||
<meta name="twitter:card" content="summary_large_image">
|
||
<meta name="twitter:description" content="">
|
||
<meta name="twitter:title" content="Dich'blog">
|
||
<meta property="twitter:domain" content="blog.dich.bid">
|
||
<meta property="twitter:url" content="https://blog.dich.bid/network-how-email-works-3/">
|
||
|
||
<link rel="alternate" type="application/atom+xml" title="Dich'blog Atom Feed" href="https://blog.dich.bid/atom.xml" />
|
||
|
||
|
||
<link rel="icon" type="image/png" href=/dich.webp />
|
||
|
||
<!-- ✅ Added center alignment styles -->
|
||
<style>
|
||
.footer {
|
||
text-align: center;
|
||
padding: 1rem 0;
|
||
}
|
||
|
||
.footer__inner {
|
||
display: flex;
|
||
justify-content: center;
|
||
flex-direction: column;
|
||
align-items: center;
|
||
}
|
||
|
||
.copyright {
|
||
text-align: center;
|
||
}
|
||
</style>
|
||
</head>
|
||
|
||
<body class="">
|
||
<div class="container">
|
||
|
||
<header class="header">
|
||
<div class="header__inner">
|
||
<div class="header__logo">
|
||
|
||
<a href="https://blog.dich.bid" style="text-decoration: none;">
|
||
<div class="logo">
|
||
|
||
Dich'blog
|
||
|
||
</div>
|
||
</a>
|
||
</div>
|
||
</div>
|
||
|
||
|
||
|
||
<nav class="menu">
|
||
<ul class="menu__inner">
|
||
<li class="active"><a href="https://blog.dich.bid">blog</a></li>
|
||
|
||
<li><a href="https://blog.dich.bid/archive">archive</a></li>
|
||
|
||
<li><a href="https://blog.dich.bid/tags">tags</a></li>
|
||
|
||
<li><a href="https://blog.dich.bid/weekly">weekly</a></li>
|
||
|
||
<li><a href="https://blog.dich.bid/search">search</a></li>
|
||
|
||
<li><a href="https://blog.dich.bid/about">about me</a></li>
|
||
|
||
<li><a href="https://blog.dich.bid/links">links</a></li>
|
||
|
||
<li><a href="https://blog.dich.bid/atom.xml">rss</a></li>
|
||
|
||
<li><a href="https://github.com/Dichgrem" target="_blank" rel="noopener noreferrer">github</a></li>
|
||
</ul>
|
||
</nav>
|
||
|
||
|
||
|
||
</header>
|
||
|
||
|
||
<div class="content">
|
||
|
||
<div class="post">
|
||
|
||
<h1 class="post-title"><a href="https://blog.dich.bid/network-how-email-works-3/">网络艺术:自建域名邮箱</a></h1>
|
||
<div class="post-meta-inline">
|
||
|
||
<span class="post-date">
|
||
2024-02-22
|
||
</span>
|
||
|
||
</div>
|
||
|
||
|
||
<span class="post-tags-inline">
|
||
:: tags:
|
||
<a class="post-tag" href="https://blog.dich.bid/tags/network/">#Network</a></span>
|
||
|
||
|
||
<div class="post-content">
|
||
<p>前言 poste.io 邮件服务基于 Docker 搭建,用的是 Haraka + Dovecot + SQLite 邮件系统,占用资源较少,安装简单,适合个人使用。</p>
|
||
<span id="continue-reading"></span><h2 id="vpsshang-de-pei-zhi">VPS上的配置</h2>
|
||
<h3 id="xiu-gai-vps-hostname">修改VPS hostname</h3>
|
||
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>hostnamectl set-hostname mail.your-domain.com
|
||
</span></code></pre>
|
||
<h3 id="xiu-gai-hostswen-jian">修改hosts文件</h3>
|
||
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>vim /etc/hosts
|
||
</span></code></pre>
|
||
<p>添加一行</p>
|
||
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>127.0.1.1 localhost.localdomain mail.your-domain.com
|
||
</span></code></pre>
|
||
<h2 id="an-zhuang-poste">安装poste</h2>
|
||
<p>docker compose文件示例:</p>
|
||
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>version: '3.7'
|
||
</span><span>
|
||
</span><span>services:
|
||
</span><span> mailserver:
|
||
</span><span> image: analogic/poste.io
|
||
</span><span> hostname: mail.your-domain.com
|
||
</span><span> ports:
|
||
</span><span> - "25:25"
|
||
</span><span> - "110:110"
|
||
</span><span> - "143:143"
|
||
</span><span> - "587:587"
|
||
</span><span> - "993:993"
|
||
</span><span> - "995:995"
|
||
</span><span> - "4190:4190"
|
||
</span><span> - "465:465"
|
||
</span><span> - "127.0.0.1:8808:80"
|
||
</span><span> - "127.0.0.1:8843:443"
|
||
</span><span> environment:
|
||
</span><span> - LETSENCRYPT_EMAIL=admin@your-domain.com
|
||
</span><span> - LETSENCRYPT_HOST=mail.your-domain.com
|
||
</span><span> - VIRTUAL_HOST=mail.your-domain.com
|
||
</span><span> - DISABLE_CLAMAV=TRUE
|
||
</span><span> - TZ=Asia/Shanghai
|
||
</span><span> - HTTPS=OFF
|
||
</span><span> volumes:
|
||
</span><span> - /etc/localtime:/etc/localtime:ro
|
||
</span><span> - ./mail-data:/data
|
||
</span></code></pre>
|
||
<ul>
|
||
<li>
|
||
<p>禁用反病毒功能(DISABLE_CLAMAV=TRUE)、禁用反垃圾邮件功能(DISABLE_RSPAMD=TRUE),可以大幅减低内存和CPU占用,请酌情设置禁用选项。</p>
|
||
</li>
|
||
<li>
|
||
<p>禁用WEB收发功能(DISABLE_ROUNDCUBE=TRUE),可以进一步减少资源占用,不过非必要不建议禁止。</p>
|
||
</li>
|
||
<li>
|
||
<p>8808为http端口,可以根据自己的需求修改。</p>
|
||
</li>
|
||
</ul>
|
||
<h2 id="dnspei-zhi">Dns配置</h2>
|
||
<table><thead><tr><th>记录类型</th><th>主机记录</th><th>记录值</th></tr></thead><tbody>
|
||
<tr><td>A</td><td>mail</td><td>1.2.3.4 (your ip)</td></tr>
|
||
<tr><td>MX</td><td>your-domain.com</td><td>mail.your-domain.com</td></tr>
|
||
<tr><td>TXT</td><td>your-domain.com</td><td>v=spf1 mx ~all</td></tr>
|
||
<tr><td>TXT</td><td>_s20160910378._domainkey.your-domain.com</td><td>k=rsa;p=MII.........</td></tr>
|
||
<tr><td>TXT</td><td>_dmarc</td><td>v=DMARC1; p=none; pct=100; rua=mailto:mail@your-domain.com</td></tr>
|
||
<tr><td>CNAME</td><td>imap</td><td>mail</td></tr>
|
||
<tr><td>CNAME</td><td>smtp</td><td>mail</td></tr>
|
||
<tr><td>CNAME</td><td>pop</td><td>mail</td></tr>
|
||
</tbody></table>
|
||
<p>最后还需到 VPS 服务商处添加一个反向 DNS,也就是 rDNS 解析,把 IP 解析到 mail.your-domain.com 这个域名,有些 VPS 商家不提供这种服务,所以需要选择好VPS服务商。</p>
|
||
<h2 id="pei-zhi-poste">配置poste</h2>
|
||
<p>通过浏览器访问<code>https://mail.your-domain.com/admin/login</code>进入poste.io的配置页面,按照提示进行配置,然后点击 Generate new key,生成 key,添加到 DNS 解析记录,就是上面最后一条解析<code>_s20160910378._domainkey.your-domain.com</code></p>
|
||
<h2 id="di-san-fang-ke-hu-duan-smtp-imap-pop3-pei-zhi">第三方客户端 SMTP/IMAP/POP3 配置</h2>
|
||
<p>搭建完毕之后我们也可以通过客户端软件连接到我们的邮箱,如thunderbird.</p>
|
||
<table><thead><tr><th>协议</th><th>服务器地址</th><th>端口</th><th>SSL</th></tr></thead><tbody>
|
||
<tr><td>SMTP</td><td>mail.your-domain.com, smtp.your-domain.com</td><td>25, 465, 587</td><td>STARTTLS</td></tr>
|
||
<tr><td>IMAP</td><td>mail.your-domain.com, imap.your-domain.com</td><td>993, 143</td><td>STARTTLS</td></tr>
|
||
<tr><td>POP3</td><td>mail.your-domain.com, pop.your-domain.com</td><td>995, 110</td><td>STARTTLS</td></tr>
|
||
</tbody></table>
|
||
<hr />
|
||
<p>Done.</p>
|
||
|
||
</div>
|
||
|
||
|
||
<div class="pagination">
|
||
<div class="pagination__title">
|
||
<span class="pagination__title-h">Thanks for reading! Read other posts?</span>
|
||
<hr />
|
||
</div>
|
||
<div class="pagination__buttons">
|
||
<span class="button previous">
|
||
<a href="https://blog.dich.bid/network-how-email-works-1/">
|
||
<span class="button__icon">←</span>
|
||
<span class="button__text">网络艺术:电子邮件的工作原理</span>
|
||
</a>
|
||
</span>
|
||
|
||
|
||
<span class="button next">
|
||
<a href="https://blog.dich.bid/about-opensource/">
|
||
<span class="button__text">乱七八糟:开源软件与协议</span>
|
||
<span class="button__icon">→</span>
|
||
</a>
|
||
</span>
|
||
</div>
|
||
</div>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
|
||
<footer class="footer">
|
||
<div class="footer__inner">
|
||
<div class="copyright">
|
||
<span>©
|
||
2025
|
||
Dichgrem</span>
|
||
<span class="copyright-theme">
|
||
<span class="copyright-theme-sep"> :: CC BY-SA 4.0 :: A friend comes from distant lands</span>
|
||
</a>
|
||
</span>
|
||
</div>
|
||
</div>
|
||
</footer>
|
||
|
||
</div>
|
||
</body>
|
||
</html>
|
||
|