$message = array(
'to' => '[email protected]',
'subject' => t('Example subject'),
'body' => t('Example body'),
'headers' => array('From' => '[email protected]'),
);
drupal_mail_send($message);
Caveats:
- Because drupal_mail() isn't called, other modules will not be able to hook_mail_alter() your output, which can cause unexpected results.
- drupal_mail_send() is ignorant about which language to send the message in, so this needs to be figured out beforehand.
- You'll have to manually specify any other e-mail headers that are required ('Content-Type', etc.). These are normally taken care of for you by drupal_mail().
In the case where your module sends several different types of e-mails, and you want those e-mail templates to be editable (for example, user module's various registration notification/password reset/etc. e-mails), using hook_mail() is still the best way to go.
This is what reported in the comments section in the documentation for drupal_mail(). If the caveats are not important in your case, then you can use the reported snippet.