Isn't this an infinite loop because you are not incrementing the $mail