Drupal implements a custom e-mail templating system. Initially it may appear that this system is overly complicated, but it allows an enormous amount of flexibility for module developers.
Sending e-mail in Drupal is a multi-step process:
drupal_mail()is called, specifying what mail is being sent and what options are unique to this specific message (the recipient's e-mail address, the language the mail should be sent in, and so on).
hook_mail()implementation specified in
drupal_mail()is called. This is where the subject and body of the mail are added.