我已经设置postfix来使用虚拟用户的入站电子邮件,configuration从MySQL读取。
但是,当我试图在本地发送邮件时,使用诸如sendmail root@localhost < testmail ,查询正在执行,但邮件没有传递到虚拟用户目录。
目录/var/mail/root被创build。
MySQLconfiguration似乎是正确的,因为执行以下查询:
SELECT destination FROM aliases WHERE mail='root@localhost' and enabled = 1 +----------------+ | destination | +----------------+ | root@localhost | +----------------+ SELECT destination FROM aliases WHERE mail='localhost' and enabled = 1; Empty set (0.00 sec) SELECT domain FROM domains WHERE domain='localhost' and enabled = 1; +-----------+ | domain | +-----------+ | localhost | +-----------+
但他们似乎被忽略。
当试图通过快递IMAPlogin时,结果如下:
1 login root@localhost <password> * BYE [ALERT] Fatal error: No such file or directory: No such file or directory
因为后缀创build的文件夹不是用户在数据库中设置的文件夹。
(很大程度上受到指导的启发):
alias_database = hash:/etc/postfix/aliases alias_maps = hash:/etc/postfix/aliases append_dot_mydomain = no biff = no config_directory = /etc/postfix mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 mynetworks_style = host myorigin = /etc/mailname readme_directory = no recipient_delimiter = + # working relayhost config here smtpd_recipient_restrictions = reject_unauth_pipelining, permit_mynetworks, reject_non_fqdn_recipient, reject_unknown_recipient_domain, reject_unauth_destination, permit smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination smtpd_sender_restrictions = permit_mynetworks, warn_if_reject reject_non_fqdn_sender, reject_unknown_sender_domain, reject_unauth_pipelining, permit virtual_alias_maps = mysql:/etc/postfix/mysql_alias.cf virtual_gid_maps = static:5000 virtual_mailbox_base = /var/spool/mail/virtual virtual_mailbox_domains = mysql:/etc/postfix/mysql_domains.cf virtual_mailbox_maps = mysql:/etc/postfix/mysql_mailbox.cf virtual_uid_maps = static:5000
为了确定postfix是否实际发送到虚拟邮箱,可以在/var/log/mail.log查看relay值。
尝试:
tail -100 /var/log/mail.log | grep relay=
你最有可能看到relay=local ,而你想要relay=virtual 。
发生这种情况是因为postfix正在传递给local_recipient_maps 。
这个问题的一个迹象是,在你的日志中你可以看到
warning: do not list domain example.com in BOTH mydestination and virtual_mailbox_domains
您可以通过用空值覆盖mydestination来解决此问题:
#/etc/postfix/main.cf mydestination =
或者迫使postfix甚至对本地邮箱使用虚拟传输 :
#/etc/postfix/main.cf local_transport = virtual local_recipient_maps = $alias_maps $virtual_mailbox_maps
第一个select是更好的,因为它解决了根本问题,而不是在一个安静的angular落锤击它。
IMAP服务器不应该直接从maildir中取得邮件吗? 或/ var / mail / foo?
我使用dovecot,并且我已经设置了一个dovecot监听的lmtp forward套接字。 当新邮件到达时,postfix将它发送到dovecot套接字。 目录等全部由dovecotpipe理。