请问有什么轻量级的支持虚拟用户的 smtp 服务器么

2018-03-05 20:53:44 +08:00
 fuergaosi

只需要能够发信,支持虚拟用户(最好是直接通过数据库就可以增改用户的)就可以了。 之前尝试使用 postfix,奈何水平不够,虚拟用户感觉没办法解决。只需要有 smtp 服务器就可以了,也不需要收信功能。 git 上翻了一下没找到合适的,希望各位老哥给点推荐。

3254 次点击
所在节点    Linux
25 条回复
wezzard
2018-03-06 07:37:07 +08:00
/etc/postfix/main.cf
```
...

mydomain = yourdomain.com

...

smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
broken_sasl_auth_clients = yes

...

virtual_mailbox_domains = $mydomain
virtual_mailbox_base = /home/vmail/
virtual_mailbox_maps = hash:/etc/postfix/vmailbox
virtual_uid_maps = static:vmail
virtual_gid_maps = static:vmail
```

/etc/postfix/master.cf
```
submission inet n - n - - smtpd
-o syslog_name=postfix/submission
-o smtpd_tls_security_level=encrypt
-o smtpd_sasl_auth_enable=yes
-o smtpd_sasl_type=dovecot
-o smtpd_sasl_path=private/auth
-o smtpd_sasl_security_options=noanonymous
-o smtpd_sasl_local_domain=$myhostname
-o smtpd_client_restrictions=permit_sasl_authenticated,reject
-o smtpd_sender_login_maps=hash:/etc/postfix/virtual
-o smtpd_sender_restrictions=reject_sender_login_mismatch
-o smtpd_recipient_restrictions=reject_non_fqdn_recipient,reject_unknown_recipient_domain,permit_sasl_authenticated,reject
```

/etc/postfix/vmailbox
```
username@yourdomain.com yourdomain.com/username
```

/etc/postfix/virtual
```
username@yourdomain.com username
```

當然,你還要新建一個 vmail 的用戶,以及分配一個 /home/vmail 的 home 目錄。

另外,我的 postfix 是使用的 dovecot 的靜態密碼文件配置的多用戶,也就是 smtpd_sasl_type = dovecot 和 smtpd_sasl_path = private/auth 這兩句的意思。你也可以按照 Linode 或者 Digital Ocean 上的文章用 postgresql 或者其他數據庫來配置一個多用戶系統。
wezzard
2018-03-06 07:38:57 +08:00
實在搞不懂,sudo tail -50 /var/log/maillog 也可以獲得很多信息,再去 Google 就可以了。
defunct9
2018-03-06 15:44:19 +08:00
搞定,mark 一下,走人。
rickliu2000
2018-03-06 21:45:18 +08:00
fuergaosi
2018-03-12 21:00:42 +08:00
今天重新安装 ubuntu 以后
defunct9 老哥帮我配置好的文件失效
然后又去翻了 google 和各种帖子
最后找到了使用 postfix 不限用户的 smtp 的配置方法
只需要在 postfix 的配置文件 main.cf 文件中添加一句
smtpd_sasl_auth_enable = no
就可以不用认证直接进行发信了
over

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/435103

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX