# SQL statement to set login map which includes the case when user is
# sending email using a valid alias.
# This is the same as virtual-alias-maps.cf, See below
cat> /etc/postfix/sender-login-maps.cf <<EOF;
dbpath=$db_path
query = SELECT destination from (SELECT destination, 0 as priority FROM aliases WHERE source='%s' UNION SELECT email as destination, 1 as priority FROM users WHERE email='%s') ORDER BY priority LIMIT 1;
EOF
# ### Destination Validation
# ### Destination Validation
# Use a Sqlite3 database to check whether a destination email address exists,
# Use a Sqlite3 database to check whether a destination email address exists,