I cant seem to find what commit caused the regression but between my last 6.x-1.x-dev release on Monday, June 8th 2009, 12:22:18 (GMT) [1244463738] and 6.x-1.0-alpha1 mimemail stopped respecting if an node file attachment should be ‘attached’ to the email.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Jackinloadup’s picture

Status: Active » Needs review
FileSize
901 bytes

This patch against 6.x-1.x-dev fixed this.

Was this on purpose?

sgabe’s picture

Status: Needs review » Reviewed & tested by the community

I applied your patch on 6.x-1.0-alpha1, tested it and works fine, so I am marking this as RTBC.

sgabe’s picture

Version: 6.x-1.0-alpha1 » 7.x-1.x-dev
FileSize
766 bytes

Revised patch against HEAD.

sgabe’s picture

Status: Reviewed & tested by the community » Fixed

Committed to HEAD.

Status: Fixed » Closed (fixed)

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

louiswolf’s picture

What is the purpose of the list parameter? If FALSE, my attachments are ignored but why would I want to do that?
I can't find any documentation.

sgabe’s picture

Let's say you upload an image using the Upload module and place that picture in the body to embed it in the message. If we don't check the list parameter the image will be attached twice. First Mime Mail will extract and embed the image placed in the body source and then attach it again because it is in the attachments too. The list parameter allows the user to upload something without attaching it to the message. I know probably this is not the usual case, because most users (hopefully) use ImageField, but it does exist.

Robbert’s picture

I'm also confused by the purpose of this parameter. If I understand it correctly, we need the list parameter in order to filter the array of attachments given to mimemail by another module (Upload in this case)? Why is it mimemail's job to filter attachments and why can't other modules just filter attachments themselves? (Or am I completely wrong?)

I have various modules that use mimemail to send mails. In these modules I just call the function mimemail, and when needed specify attachments with an array of the following shape (as listed in the documentation of the function):

   Array
   (
     [0] => Array
       (
         [filepath] => '/path/to/file.name'
         [filemime] => 'mime/type'
       )
   )

But because of if($a->list) all my attachments are being ignored unless I use an array of the following shape:

   Array
   (
     [0] => Array
       (
         [filepath] => '/path/to/file.name'
         [filemime] => 'mime/type'
         [list] => true
       )
   )

So, either this behavior should be documented or other modules should filter attachments themselves and this check should be removed.

Edit: just another possibility, instead of if($a->list) we could use if(!isset($a->list) || $a->list), that way attachments are not ignored if the field isn't specified at all.

sgabe’s picture

Since Upload is a core module IMHO we should conform to it. However, I agree this lacks documentation which should be covered in #614782: Update README.txt and additional documentation and of course updated in the mimemail_prepare_message() function's parameter description. This will be fixed in the next release.

sgabe’s picture

Status: Closed (fixed) » Needs review
FileSize
652 bytes

I didn't see your update Robert, but I thought the same thing. I am attaching a patch with this modification what is hopefully acceptable for everyone.

Dane Powell’s picture

I would like to see #10 committed, since the list parameter is not part of the core file object and is not always specified - for instance, Notifications Files does not work with MIME mail because it doesn't set the list parameter (and has no reason to):
#853308: No files sent with Mimemail sending method

Barberousse’s picture

Dane Powell’s picture

Status: Needs review » Reviewed & tested by the community

Excellent- would love to see this committed, as would many users of Notifications Files I'm sure...

sgabe’s picture

Status: Reviewed & tested by the community » Fixed

Committed to HEAD.

Dane Powell’s picture

Thanks!

Status: Fixed » Closed (fixed)

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