How can I route automated emails through an email function in my module?
I think this is what you're looking for:

http://api.drupal.org/api/drupal/modules!system!system.api.php/function/hook_mail_alter/7

"hook_mail_alter() allows modification of email messages created and sent with drupal_mail()... All core modules use drupal_mail() for messaging, it is best practice but not mandatory in contributed modules."