yányào.com

Self Host Maddy Mail Server

Posted at — Dec 1, 2020

maddy

Composable all-in-one mail server. https://github.com/foxcpp/maddy

准备自建系列服务替换掉 google 全家桶,先试了传统的 Postfix, Dovecot, OpenDKIM, OpenSPF, OpenDMARC 套餐,但是本人水平菜,机器配置也不高,折腾两天还没跑起来,正好看到订阅的 changelog 推荐了 maddy 1 于是搓搓手气试试这个邮局方案,以下是满足个人喜好的优点

install

mkdir -p /data/maddy

# hard link caddy's crt and key to maddy
ln var/lib/caddy/.local/share/caddy/certificates/acme-v02.api.letsencrypt.org-directory/${domain}/${domain}.crt /data/maddy/${domain}.crt
ln var/lib/caddy/.local/share/caddy/certificates/acme-v02.api.letsencrypt.org-directory/${domain}/${domain}.key /data/maddy/${domain}.key


# foxcpp/maddy:v0.4.2
podman run \
  --name maddy \
  -v /data/maddy:/data \
  -p 25:25 \
  -p 143:143 \
  -p 587:587 \
  -p 993:993 \
  -p 465:465 \
  yanyaoer/maddy:master


# add user
podman run --rm -it -v /data/maddy:/data --entrypoint /bin/maddyctl yanyaoer/maddy:master creds create yanyao@mail.yadanhe.com

参考文档配置2 完后发送邮件对方可收,本地 thunderbird 接收回复邮件时有问题

workaround

diff --git a/build.sh b/build.sh
index a76f6b6..b6e2eb2 100755
--- a/build.sh
+++ b/build.sh
@@ -119,6 +119,7 @@ read_config() {
         export MADDY_SRC=
     fi

+    export CGO_LDFLAGS_ALLOW='-Wl,-z,relro,-z,now'
     export CGO_CFLAGS="-g -O2 -D_FORTIFY_SOURCE=2 $CFLAGS"
     export CGO_CXXFLAGS="-g -O2 -D_FORTIFY_SOURCE=2 $CXXFLAGS"
     export LDFLAGS="-Wl,-z,relro,-z,now $LDFLAGS"

** update: 2021-07-23 ** v0.4.4 直接下载解压以上功能正常使用,不再使用 podman 部署

alternative

以下方案不太合口味,日后有缘再试


  1. https://changelog.com/news/maddy-a-composable-allinone-mail-server-ljEe ↩︎

  2. https://foxcpp.dev/maddy/tutorials/setting-up/ ↩︎

  3. https://github.com/foxcpp/maddy/issues/300 ↩︎

  4. https://github.com/foxcpp/maddy/issues/299#issuecomment-735862091 ↩︎