Drupal allows you to override its default mail handling, by setting the 'smtp_library' variable to a file name, and including in that file a function called
drupal_mail_wrapper() that will send the mail. This function is called from
drupal_mail_send() in Drupal 6.x, and from
drupal_mail() in Drupal 5.x.
The function arguments changed in Drupal 6.x. In 5.x, the function arguments were the same as the arguments to
drupal_mail() (individual arguments for mail key, to, from, etc.). In 6.x, there is only one argument, a
$message array as in
drupal_mail_send(). See the respective calling functions for more information.