what you would want to do is have the link spawn a new window, that page will have your mail function on it. then you would say like
if (the email address exists) {
mail (mail the password);
echo "mail sent";
}
else {
echo "address doesnt exist"
}
hope my half code half logic helps. for checking if that mail is there you would see if the query is greater than nothing like this > " "
Sean