Here's a work around. Create a view of vmail.domain in amavisd. For example:
mysql -u root -p
msyql> create view amavisd.vmail_domian as select domain from vmail.domain;
mysql> GRANT SELECT ON `vmail` . * TO 'amavisd'@'localhost';
mysql> \q
edit /etc/amavisd/amavisd.conf and bottom of file make the following changes:
@storage_sql_dsn = (
['DBI:mysql:database=amavisd;host=127.0.0.1;port=3306', 'amavisd', 'xxxxxxxxxxxxxxx'],
);
# Uncomment below two lines to lookup virtual mail domains from MySQL database.
#@lookup_sql_dsn = (
# ['DBI:mysql:database=vmail;host=127.0.0.1;port=3306', 'vmail', 'xxxxxxxxxxxxxxxx'],
#);
# For Amavisd-new-2.7.0 and later versions. Placeholder '%d' is available in Amavisd-2.7.0+.
$sql_select_policy = "SELECT domain FROM vmail_domain WHERE domain='%d'";
It worked for me.