feat(email): 初始化自建邮箱 MVP

- 新增 Go + SQLite 后端,支持登录、域名、邮箱、别名、联系人、规则、统计与邮件收发。
- 新增 Webmail 前端,支持多邮箱切换、邮件列表/阅读/写信、附件、搜索、主题切换与个人中心。
- 新增 Docker Compose 部署骨架,补充 Postfix、Dovecot、OpenDKIM、Nginx 配置与部署说明。
This commit is contained in:
LanQin
2026-06-14 01:07:48 +08:00
commit 3ef8caa319
85 changed files with 13649 additions and 0 deletions
+10
View File
@@ -0,0 +1,10 @@
FROM debian:bookworm-slim
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends dovecot-core dovecot-imapd dovecot-lmtpd dovecot-sqlite ssl-cert ca-certificates && rm -rf /var/lib/apt/lists/*
COPY dovecot.conf /etc/dovecot/dovecot.conf
COPY dovecot-sql.conf.ext /etc/dovecot/dovecot-sql.conf.ext
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
EXPOSE 993 24 12345
CMD ["/entrypoint.sh"]
+5
View File
@@ -0,0 +1,5 @@
driver = sqlite
connect = /data/lanqin.db
default_pass_scheme = BLF-CRYPT
password_query = SELECT address AS user, password_hash AS password FROM mailboxes WHERE address = '%u' AND status = 'active'
user_query = SELECT '/var/mail/vhosts/' || substr(address, instr(address, '@') + 1) || '/' || local_part AS home, 'maildir:/var/mail/vhosts/' || substr(address, instr(address, '@') + 1) || '/' || local_part || '/Maildir' AS mail, 5000 AS uid, 5000 AS gid FROM mailboxes WHERE address = '%u' AND status = 'active'
+48
View File
@@ -0,0 +1,48 @@
protocols = imap lmtp
listen = *
base_dir = /var/run/dovecot/
log_path = /dev/stderr
info_log_path = /dev/stdout
ssl = yes
ssl_cert = </etc/ssl/certs/ssl-cert-snakeoil.pem
ssl_key = </etc/ssl/private/ssl-cert-snakeoil.key
mail_home = /var/mail/vhosts/%d/%n
namespace inbox {
inbox = yes
mailbox Drafts { special_use = \Drafts }
mailbox Sent { special_use = \Sent }
mailbox Trash { special_use = \Trash }
mailbox Archive { special_use = \Archive }
mailbox Spam { special_use = \Junk }
}
passdb {
driver = sql
args = /etc/dovecot/dovecot-sql.conf.ext
}
userdb {
driver = sql
args = /etc/dovecot/dovecot-sql.conf.ext
}
service imap-login {
inet_listener imaps { port = 993 ssl = yes }
}
service lmtp {
inet_listener lmtp { address = 0.0.0.0 port = 24 }
}
service auth {
inet_listener postfix-auth {
address = 0.0.0.0
port = 12345
}
}
protocol lmtp {
postmaster_address = postmaster@localhost
}
+7
View File
@@ -0,0 +1,7 @@
#!/bin/sh
set -eu
addgroup --system --gid 5000 vmail 2>/dev/null || true
adduser --system --uid 5000 --gid 5000 --home /var/mail/vhosts --no-create-home vmail 2>/dev/null || true
mkdir -p /var/mail/vhosts
chown -R 5000:5000 /var/mail/vhosts
exec dovecot -F