Thanks for the attachment and html additions.
I actually had a go myself this week on an older version of the module, unaware that this feature had already been added :-}

Anyway, the current behaviour is to add the 'attachment' as a
Content-Type: application/octet-stream
... which comes to many email clients as a scary blob.

Attached patch uses the existing drupal file_check_upload() instead, and thus sends the correct MIME header ... so that my attached image actually looks like an image at the other end.

It also includes an array initializer fix which I believe was triggering everyones array_merge errors.

I'd like to see a fix for the way it currently deliberately excludes the current user from recieving their own mails. It's a nice confirmation to see your mails arrive at the same time as everyone else.

I tried unsetting that check in the code, but then found myself getting 70 copies as I'd put it into 'burst mode' (Max number of users) and got a copy each time.

(I'm now kicking myself because this mail went out to several hundred folk with my very personal email address rather than that of the client website I was asked to do this for. Arrg.)

CommentFileSizeAuthor
mass_contact_mime_type.patch1.18 KBdman

Comments

oadaeh’s picture

Status: Needs review » Needs work

I spent a while playing with your patch. First, your fix for the array_merge problem doesn't actually fix it. Secondly, there are one or more errors in your code (spurious parenthesis, etc.), such that the code doesn't work once the patch is applied.

I believe I get the gist of your patch, so I can make the necessary changes to the code, or, if you prefer, you may re-roll your patch against current 5.x-2.x CVS without the array declaration and with the working code corrections.

dman’s picture

the array_merge error I was seeing were triggered by the merge being attempted on an uninitialized array (when the list ends up with no valid addresses, the list isn't even an array) . So initializing it fixed that for me. There may be other places this happens as well, so my fix may be unrelated to other folks problems.

Yep, it looks like there was a typo in creating the save-as filename. My mail client seemed to handle it anyway, so I didn't see any problem. I wasn't aware it stopped the code from working however.

Merge it however you see fit, I was just throwing it out there, as I only used the module for a one-off mailout and am not really keeping up to date with it.

oadaeh’s picture

Status: Needs work » Closed (fixed)