In the current version of mime mail it's not possible to send attachments via drupal_mail()/hook_mail(). I don't understand why, because its only a little thing to change (see my attachment)...

Usage example:

function mymodule_mail($key, &$message, $params) {
   [...]
   $file = new stdClass();
   $file->filename = 'example.pdf';
   $file->filepath = file_directory_temp().'/example.pdf';
   $message["attachments"]=array($file);
   [...]
}

Comments

sgabe’s picture

Status: Active » Needs review

Changing status, since we have a patch to review.

asak’s picture

...

javi-er’s picture

Version: 6.x-1.0-alpha1 » 6.x-1.0-alpha5
StatusFileSize
new1.71 KB

Hi, I'm using this change in a production site and it's working well, it now allows me to attach a file via hook_mail.
However, the attached patch is in a wrong format, I'm attaching a CVS patch with this change for the latest version (DRUPAL-6--1-0-ALPHA5)

Cheers!

javi-er’s picture

Status: Needs review » Reviewed & tested by the community
tobiasb’s picture

Version: 6.x-1.0-alpha5 » 6.x-1.x-dev
Status: Reviewed & tested by the community » Needs review
StatusFileSize
new789 bytes

@javierreartes your patch was not better :D.

Now here a patch for 6.x.

sgabe’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev
Category: feature » bug
StatusFileSize
new835 bytes

Actually the 6--1 branch is not used, patches should be made against HEAD. I think we can consider this as a bug.

sgabe’s picture

Title: attachments via hook_mail » Set $attachments in drupal_wrap_mail()

Changing title to a more descriptive one.

sgabe’s picture

Status: Needs review » Fixed

Committed to HEAD.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.