I assume that you already know how to handle queries from PHP. Then you can do it like this:
$sql = "SELECT mail FROM table HAVING COUNT(mail) > 1 GROUP BY mail;";
That will give yu the mail addresses. To get the id from everyone that have the same addess you can use something simular to this:
//Loop through the result for the query above
$sql2 = "SELECT id, mail FROM table HAVING mail = '" . $row['mail'] . "';";
// Get the result and do a second loop to handle the result
I hope this helps.