I'm using a script that sends a confirmation email to new users but while testing it i haven't received a mail yet. Is there a way to find the error? (like mysql_error() gives the error for queries)
Well, you could check the return value. If it is false, that means that the email was not sent. The problem is that even if it is sent, it may not be received, and even if it is received, it may end up marked as junk.