How can I debug an email function? I'm using flag_friend module and want to customize the email that is sent after a friend request is made. 

What's the best way developing code for email functions like this where you can't just reload the page to see your changes? 

I would have to go back, remove the friend request and create a new request to trigger the next email, then wait for the email to arrive.
You could write an automated test with SimpleTest.

Takes quite a bit of initial effort but once you have it, it is a matter of a few seconds to re-run your test.

Simpletest also automatically intercepts sent mails and you can then get them directly in the test with $this-&gt;drupalGetMails().

See for example How do I write automated tests for a Drupal site?