Logging emails in drupal 6

Ever tried to log all your email?
People come up with the craziest ideas to log email but luckely in drupal there is a nice way to log your emails to a file in your system.

I'm currently using it only for debugging but here it goes!

ps: Don't forget to replace your_module_name with, well yeah, your module name!
Requirement : Devel module
Location of log file : /tmp/drupal_debug.txt

/**
* Implementation of hook_mail_alter().
*
* @param $message A structured array containing the message to be altered. keys in this array include: id, to, subject, body, from, headers
*/
function your_module_name_mail_alter(&$message) {

dd($message);
}