# get mbox id, which also verfies that email address exists
dbquery="SELECT vm_mboxes.id FROM vm_mboxes, vm_domains WHERE vm_mboxes.mbox='$mbox' AND vm_mboxes.domain_id=vm_domains.id AND vm_domains.domain='$domain';"
mbox_id=`eval$dbcmd$dbcmdopts\"$dbquery\"`
if[ -z $mbox_id];then
# mbox does not exist, can't create forward
echo"ERROR: Address to Forward ($email) does not exist."
exit1
elif["$mbox_id" -gt '0'];then
# verified mbox, check for existing forward
dbquery="SELECT id FROM vm_forwards WHERE mbox_id='$mbox_id';"
vm_forwards_id=`eval$dbcmd$dbcmdopts\"$dbquery\"`
if[ -z $vm_forwards_id];then
# existing forward does not exist, can't modify
echo"ERROR: Forward for $email does not exists, can't edit. Add new forward instead."
exit1
else
dbquery="UPDATE vm_forwards SET forward_to='$forward'"