/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 或者其他數據庫來配置一個多用戶系統。