虚拟用户无法接收电子邮件,但他们可以发送。UNIX 用户可接收和发送。我做错了什么?
root@localhost: postconf -n
append_dot_mydomain = no
biff = no
broken_sasl_auth_clients = yes
compatibility_level = 2
disable_vrfy_command = yes
home_mailbox = maildir/
inet_interfaces = all
inet_protocols = all
mailbox_command =
mailbox_size_limit = 0
mydestination = $myhostname, localhost, localhost.localdomain, localhost
mydomain = example.com
myhostname = example.com
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
myorigin = $mydomain
readme_directory = no
recipient_delimiter = +
relayhost =
smtp_tls_note_starttls_offer = yes
smtp_tls_security_level = may
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtp_use_tls = yes
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
smtpd_delay_reject = yes
smtpd_helo_required = yes
smtpd_helo_restrictions = reject_non_fqdn_helo_hostname, reject_invalid_helo_hostname, reject_unknown_helo_hostname
smtpd_recipient_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_unauth_destination, reject_invalid_hostname, reject_non_fqdn_hostname, reject_non_fqdn_sender, reject_non_fqdn_recipient, reject_unknown_sender_domain, reject_rbl_client sbl.spamhaus.org, reject_rbl_client cbl.abuseat.org
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain =
smtpd_sasl_path = private/auth
smtpd_sasl_security_options = noanonymous
smtpd_sasl_type = dovecot
smtpd_tls_CAfile = /etc/letsencrypt/live/example.com/fullchain.pem
smtpd_tls_auth_only = no
smtpd_tls_cert_file = /etc/letsencrypt/live/example.com/fullchain.pem
smtpd_tls_key_file = /etc/letsencrypt/live/example.com/privkey.pem
smtpd_tls_loglevel = 1
smtpd_tls_received_header = yes
smtpd_tls_security_level = may
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_tls_session_cache_timeout = 3600s
smtpd_use_tls = yes
virtual_alias_maps = pgsql:/etc/postfix/postgresql/virtual.cf
virtual_gid_maps = static:1000
virtual_mailbox_base = ~/maildir
virtual_mailbox_maps = pgsql:/etc/postfix/postgresql/boxes.cf
virtual_maps = pgsql:/etc/postfix/postgresql/virtual.cf
virtual_transport = virtual
virtual_uid_maps = static:1000
错误
to=<[email protected]>, relay=local, delay=0.1, delays=0.09/0.01/0/0.01, dsn=5.1.1, status=bounced (unknown user: "test")
虚拟.cf:alias_email => email
boxes.cf:username => /home/username
运输.cf:email => 'virtual'
table=v_alias
select_field=alias
where_field=email
hosts=localhost
盒子.cf输入: 测试返回:/home/测试
table=auth
select_field=maildir
where_field=username
hosts=localhost
运输文件输入:[电子邮件保护] 返回: 虚拟的:
table=mail_transport
select_field=transport
where_field=domain
hosts=localhost
数据库设置:
class auth():
user = ForeignKey(User, on_delete=models.CASCADE)
username = CharField(max_length=255)
password = CharField(max_length=255)
maildir = CharField(max_length=255)
class v_alias():
user = ForeignKey(User, on_delete=models.CASCADE)
alias = CharField(max_length=255)
email = CharField(max_length=255, unique=True)
status = IntegerField(choices=ADDRESS_STATUS, default=1)
class mail_transport():
domain = CharField(max_length=255)
transport = CharField(max_length=255)