I was using mimemail()
, a function defined from the MIME mail module, in Drupal 6 to send emails using attachments.
The Drupal 7 module doesn't have mimemail()
.
What function should I use in Drupal 7, instead of mimemail()
?
Drupal Answers is a question and answer site for Drupal developers and administrators. It only takes a minute to sign up.
Sign up to join this communityThe reason the mimemail()
function does not exist for Drupal 7 is because it is not needed.
See, for instance, issue: API function for quick send html mail without uneccessary operations (mimemail analog from 6.x) in the project's issue queue;
On Drupal 7 calling
drupal_mail()
is enough. See theREADME.txt
anddrupal_mail_system()
for more information.
The general idea is that you set up the Drupal to use MimeMailSystem
for some or all mail messages sent by your module:
mailsystem_set(array(
'{$module}_{$key}' => 'MimeMailSystem', // Just messages with $key sent by $module.
'{$module}' => 'MimeMailSystem', // All messages sent by $module.
));
and then calling drupal_mail()
is enough.