在Ubuntu Server 12.04计算机上,我为/etc/postfix/virtual
中的特定地址设置了一个电子邮件转发器:
example@mydomain.com postfix-test@dotancohen.com
地址postfix-test@dotancohen.com
有效并接收邮件。当我向example@mydomain.com
发送邮件时,我会在日志中收到:
warning: hash:/etc/postfix/virtual is unavailable. open database /etc/postfix/virtual.db: No such file or directory
warning: hash:/etc/postfix/virtual lookup error for "example@mydomain.com"
warning: 705B58190E: virtual_alias_maps map lookup problem for example@mydomain.com -- deferring delivery
为什么postfix无法找到/etc/postfix/virtual file
?
$ ls -la
total 96
drwxr-xr-x 3 root root 4096 Jul 4 08:46 .
drwxr-xr-x 102 root root 4096 Jun 24 06:23 ..
-rw-r--r-- 1 root root 274 Jun 24 06:23 dynamicmaps.cf
-rw-r--r-- 1 root root 1549 Jul 4 08:46 main.cf
-rw-r--r-- 1 root root 5531 Jun 24 06:23 master.cf
-rw-r--r-- 1 root root 19707 Feb 20 20:03 postfix-files
-rwxr-xr-x 1 root root 8729 Feb 20 20:03 postfix-script
-rwxr-xr-x 1 root root 26498 Feb 20 20:03 post-install
drwxr-xr-x 2 root root 4096 Feb 20 20:03 sasl
-rw-r--r-- 1 root root 43 Jul 4 08:27 virtual
-rw-r--r-- 1 root root 130 Jul 4 08:26 vmailbox
$ cat virtual
example@mydomain.com post-test@dotancohen.com
$ cat main.cf | grep virtual
virtual_mailbox_domains = mydomain.com
virtual_mailbox_base = /var/mail/vhosts
virtual_mailbox_maps = hash:/etc/postfix/vmailbox
virtual_minimum_uid = 100
virtual_uid_maps = static:5000
virtual_gid_maps = static:5000
virtual_alias_domains = fastupfront.com
virtual_alias_maps = hash:/etc/postfix/virtual
# virtual_alias_maps = /etc/postfix/virtual # I tried without the 'hash:' prefix as well.
请注意,mydomain.com
是匿名的。实际上,文件中使用的域名是一个真实的域名,它的A和MX记录指向该服务器的IP地址,并为Apache提供服务的网页。上周DNS记录发生了变化,所以我知道它们已经传播了。
答案 0 :(得分:37)
问题是在编辑/etc/postfix/virtual
后需要执行以下命令:
$ sudo postmap /etc/postfix/virtual
$ sudo service postfix reload