Figured it out, I think:
(1) For some module, create a mail template to handle the plaintext requests, the details of which depend on how you're putting together your messages. For me, this works:
function mymodule_mail($key, &$message, $params) {
switch ($key) {
...
case 'plaintext':
$message['subject'] = $params['message_header'];
$message['body'] = $params['message_body'];
break;
}
}
(2) Use mailsystem_set
to set up an entry in the mail_system
variable that points to the combined module and the key -- mymodule_plaintext
in this case -- and that specifies the mail system DefaultMailSystem:
module_load_include('module', 'mailsystem');
mailsystem_set(
array(
'vr_random_plaintext' => 'DefaultMailSystem',
)
);
(See mimemail.module
for tips on doing this; since it only needs to be run once, they recommend doing it in a hook_enable
handler.)
(3) You should then be able to send plaintext messages by calling drupal_mail()
and specifying mymodule
and plaintext
as the module and mail_template for the message.
This is working for me, although I may have glossed over a thing or two. If there are questions, post away...